Tag: ASC Specifies bytes nal specified position pytho statistic output white
Variable naming rules:
1, can only be letters, numbers, underline any combination
2. The first character of a variable cannot be a number
3. The following keywords cannot be used as variable names:
And, as, assert, break, class, continue, Def, Del, elif, else, except, exec, finally, for , from, Global, if, import, in, is, Lambda, not, or, pass, print, raise, return, try, while, with, yield
4, general constant all uppercase letters
5. Official Recommendation: a_b_1 = variable
Computer minimum representation unit: bit binary one
Computer minimum storage unit: 8bits = 1Byte = 1 bytes
1024byte = 1KBytes 1KB 1024x768 assic character
1024KB = 1mbytes
1024mbytes = 1GB
1024GB = 1TB
Data type: (double quotation marks are double quotation marks in English)
int (integer type)
Long (integer)
Float (float type)
Complex (plural)
Boolean value (True or FALSE, True or FALSE, 1 or 0)
String: The quoted value is the string
name = "Syan yans\n" (not modifiable)
Age = 20
Remove white space: Name.strip () (remove only two blanks, the middle does not go)
Segmentation
Length: Len (name)
Index: name[2]
Slices: name[0:3] Gu Tou regardless of the tail
Formatted output: msg = "My name is%s, I am%s"% (name, age)
Splicing: msg = "My name is" + name (string and number cannot be spliced)
list: name = [] Empty list
stored value: name = ["Syan", "Yans", "yans1", "Jack", "Rian"]
value: name[1]
change value: name[1] = "Bob"
added: Name.append ("Luci") ————— > Append to Last
Insert before specified position: Name.insert (1, "Sun")
Delete value: Del name[3]
name.remove ("Syan")
accurate to a value: Name.index ("Yans")
name[name.index ("Yans")] = "yans1"
statistics How many duplicate values: Name.count ("yans1")
sort: Name.sort () ———— > in alphabetical order by ASCII code
name.reverse () ————— > in reverse order of ASCII code
value: Name[0:4]
interval value: Name[0:-1:2] ————— > Last value refers to length (default interval 1)
Python notes-1