;>> s3 = 'user/jm/Desktop '>>> s3.split ('/') ['user', 'jm ', 'desktop '] # strip ([chars]) on the string, execute lstrip () and rstrip () (remove the character specified at the beginning and end of the string) >>> s4 = '*** Hello, *** world ***'> S4.strip ('*') 'Hello, *** world' # character of the string converted by the translate () method based on the table (containing 256 characters) given by the parameter table, put the characters to be filtered out in the deletechars parameter. Table = st
An array is a group of elements with some common characteristics, including similarity and type. Each element is distinguished by a special identifier, called a key, and each key has a value 1. what is an array?
An array is a group of elements with some common characteristics, including similarity and type.
Each element is distinguished by a special identifier, called a key, and each key has a value
1. two ways to create an array:
1.1 Use the array () function
The code is as follows:
$ Userna
A What is an array
An array is a set of elements that have some common characteristics, including similarity and type.
Each element is distinguished by a special identifier, called key, and each key has a value
1. Two ways to create an array:
1.1 using the array () function
Copy CodeThe code is as follows:
$usernames = Array (' Alerk ', ' Mary ', ' Lucy ', ' Bob ', ' Jack ', ' John ', ' Mark ');
foreach ($usernames as $name)
{
Echo $name. '
';
}
?>
An array is a group of elements with some common characteristics, including similarity and type. Each element is distinguished by a special identifier, called a key, and each key has a value 1. what is an array?
An array is a group of elements with some common characteristics, including similarity and type.
Each element is distinguished by a special identifier, called a key, and each key has a value
1. two ways to create an array:
1.1 Use the array () function
The code is as follows:
$ User
, \n,\t3 print (v)Output:Hexin
) Zfill
Function: Fill 0ZfillExample:1 name = ' Hexin ' 2 v = Name.zfill (3) print (v)Output:000000000000000hexin2. Integerclass int
1) bit_length
Function: The minimum number of digits for the binary representation of the current integerBit_lengthExample:Age = 4 # 100print (Age.bit_length ())Output:3
2) To_bytes
Function: Gets the byte representation of the current datato_bytesExample:Age = Allv = age.to_bytes (10,byteorde
= Age.to_bytes (10,byteorder= ' big ') v = age.to_bytes (10,byteorder= ' little ') print (v)Output:B ' \x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00 '3.list ListClass ListVariable type
1) Append
Function: AppendAppendExample:User_list = [' Tom ', ' Liu ', ' Jack ', ' n '] # variable type user_list.append (' Hex ') print (user_list)Output[' Tom ', ' Liu ', ' Jack ', ' n ', ' hex ']
2) Clea
dataTo_bytesExample:Age = 15v = Age.to_bytes (10,byteorder= ' big ') v = age.to_bytes (10,byteorder= ' little ') print (v)Output:B ' \x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00 '3.list ListClass ListVariable type
Create
A = [' dog ', ' eric ', 123]a = List ([' Dog ', ' Eric ', 123]) print (a)Output[' Dog ', ' Eric ', 123]
In judging
A = [' dog ', ' Eric ', 123]if ' Eric ' in A: print (True) print (a)Outputtrue[' dog ', ' Eric ', 123]
Index
val = a[0]
Append command (Command a) Sed ' [address] a the-line-to-append ' input-file Append a row after the second line (there may be a problem with the original, there is no line number to write the name) [[Email protected] ~]# sed ' 2 a 203,jack johnson,engineer ' Employee.txt 101,johnnynynyny Doe,ceo 102,jason Smith,it Manager 203,jack Johnson,engineer 103,raj Reddy,sysadmin 104,anand Ram,developer 105,jane Mill
Seven]
Second, just sing aloud, others do not hear the sound of voice when the sound card settings:
[Figure Eight]
Third, sing karaoke when the sound card settings:
Now talk about the principle of setting, suitable for all HD sound cards, AC97 sound card. Let's say a few definitions:
Volume Control window The meaning of each purpose:
Master Volume: Sound card Total Volume
Waveform: Music Volume
Software synth
sharing, but in most cases, we want to be able to authenticate users who access Shared Files and assign relevant permissions.
Make an experiment:
The company has three departments: finance, personnel, and technology.Requirements:1. Each department has a public folder on the file server. This folder can only be accessed by employees of the corresponding department and written to it, but cannot be deleted, it cannot be accessed by employees of other departments.2. Each employee has an independen
operation on nonexistent key
(integer) 0
redis > Zcard non_exists_key
(integer) 0
zcount Key min Max
Returns the number of members in an ordered set key, where the score value is between Min and Max (the default includes the score value equals min or max).Refer to the Zrangebyscore command for detailed instructions on how to use the parameter min and Max.Available Versions:2.0.0+complexity of Time:O (log (N) +m), N is the cardinality of the ordered set, and M is the number of elements between
previous password has expired and cannot be logged in szdb:~ # Mysql-ufred-pfrederror 1045 (28000): Access denied fo R user ' fred ' @ ' localhost ' (using password:yes)--Login successfully with new password below szdb:~ # mysql-ufred-ppasswd[emailprotected][(None) ]>--Retrieves the database for the presence of the Jack user, the following password is null[emailprotected][(none)]> Select Host,user,password from Mysql.user where User= '
. The previous password has failed. Unable to login szdb:~ # mysql-ufred-pfred ERROR 1045 (28000): Access denied for user ' Fred ' @ ' localhost ' (using Password:yes)--To Under use new Password login Success szdb:~ # MYSQL-UFRED-PPASSWD [emailprotected][(none)]>--Retrieve the database for the presence of the Jack user.
For example the following password is null [emailprotected][(None)]> Select Host,user,password from Mysql.user where user= '
default propertiesc) Array Condition:Public @interface Theyannotation {String[] Value (); Value is a special attribute that can omit the value name}Annotations Use@TheyAnnotation (value={"TV", "Washing Machine", "Computer"})Or@TheyAnnotation ({"TV", "Washing Machine", "Computer"})d) Reflection annotations: Annotations can be used to some extent to override parameters, property files, XML filesCodeAnnotation class@Target (Elementtype.method)@Retention (Retentionpolicy.runtime)Public @interface R
] ~]# postfix Check//checking syntax error (same as Named-check usage)[[email protected] ~]# systemctl restart Postfix//Restart Service[[email protected] ~]# postconf–n//view postfix non-default and has been in effect configuration-------------Add a mail test account--------------[[email protected] ~]# Groupadd mailusers//Create Group to test account[Email protected] ~]# useradd-g mailusers-s/sbin/nologin JackCreating a Jack account belongs only to th
directly access the database.
Listing 1. access/get. php
Function get_user_id ($ name){$ Db = mysql_connect ('localhost', 'root', 'password ');Mysql_select_db ('users ');
$ Res = mysql_query ("SELECT id FROM users WHERE login = '". $ name ."'");While ($ row = mysql_fetch_array ($ res) {$ id = $ row [0];}
Return $ id;}
Var_dump (get_user_id ('Jack '));?>
Note that the mysql_connect function is used to access the database. Pay attention to the query. u
out of range
List can also be accessed in reverse order. The subscript "x" is used to represent the sequence number. For example, the subscript-1 indicates the first element to be counted down:
>>> L = [12, 'China', 19.998]>>> print L[-1]19.998
-4 is clearly out of bounds.
>>> print L[-4]Traceback (most recent call last): File "
", line 1, in
print L[-4]IndexError: list index out of range>>>
List is added to the end by using the built-in append () method, and to the
= mysql_query ('select id FROM users WHERE login = ''. $ name .''');While ($ row = mysql_fetch_array ($ res) {$ id = $ row [0];}Return $ id;}Var_dump (get_user_id ('Jack '));?>Pay attention to the application of the mysql_connect function to visit the database. Pay attention to the query, and apply the string connection to add the $ name parameter to the query.This technique has two good exchange plans: pear db module and PHP Data Objects (PDO) class
5 Easy-to-commit PHP database errors---Include database schema design, database access, and business logic code that uses the database---and their solutions.
If only one way to use the database is correct ...
You can create database design, database access, and database-based PHP business logic code in a number of ways, but in the end it usually ends in error. This article explains the five common problems that occur in the database design and the PHP code that accesses the database, and how t
login = '". $ name ."'");
While ($ row = mysql_fetch_array ($ res) {$ id = $ row [0];}
Return $ id;
}
Var_dump (get_user_id ('Jack '));
?>
Note that the mysql_connect function is used to access the database. Pay attention to the query. use string connection to add the $ name parameter to the query.
This technology has two good alternatives: the pear db module and the PHP Data Objects (PDO) class. Both provide abstraction from the choice of a spec
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service