Pycharm the Use
IDE (Integrated Development Environ ment): Integrated development Environment
Vim: A classic Linux text editor (Novice and great gods like to use)
The Emacs:linux text editor is easier to use than vim.
Eclipse:java IDE, also supports python,c,c++
Visual Studio: IDE developed by Microsoft, supports python,c++,java,c#
notepad++: Python Support
Developed by Sublim:python
Pycharm: IDE primarily for python development
Show Toolbars:
Set the main interface font size
Run
Set automatically generate author and time
(English-Chinese word translation
Interpreter: Interpreter (translator) Toolbar: Toolbar Salary: Payroll Location: Position Untitled: Unnamed Fullstack: Full stack (can do anything)
CTRL +? : Press the shortcut key----"Full comment" when all is selected)
Character formatting output
PLACEHOLDER:
%s: Representing string%d: representing integer%f: floating-point number
The result is:
Data type initial:
1. Digital
2 is an example of an integer.
Long integers are just larger integers.
3.23 and 52.3E-4 are examples of floating-point numbers. The e tag represents a power of 10. Here, 52.3E-4 means 52.3 * 10-4.
( -5+4j) and (2.3-4.6j) are examples of complex numbers, where -5,4 is a real number, j is an imaginary number, and what is the plural in mathematics?
int (integral type)
On a 32-bit machine, the number of integers is 32 bits and the value range is -2**31~2**31-1, which is -2147483648~2147483647
On a 64-bit system, the number of integers is 64 bits and the value range is -2**63~2**63-1, which is -9223372036854775808~9223372036854775807
Long (integer)
Unlike the C language, Python's long integers do not refer to the positioning width, that is, Python does not limit the size of long integer values, but in fact, because of limited machine memory, we use a long integer value can not be infinite.
Note that, since Python2.2, Python automatically converts integer data to long integers if an integer overflows, so it does not cause any serious consequences if you do not add the letter L after long integer data.
Float (float type)
A floating-point number is used to process real numbers, which are numbers with decimals. Similar to the double type in C, accounting for 8 bytes (64 bits), where 52 bits represent the bottom, 11 bits represent the exponent, and the remaining one represents the symbol.
Complex (plural)
The complex number consists of real and imaginary parts, the general form is X+yj, where x is the real part of the complex, and Y is the imaginary part of the complex, where x and y are real numbers.
Note: Small number pools exist in Python:-5 ~ 257
2. Boolean value
True or False
Ture or False
1 or 0
3. String
"Hello World"
A string enclosed in single quotation marks ' or double quotation marks '.
Single and double quotes are basically no different, the only thing to note is that single and double quotation marks are separated by "'" or "" in a string.
The corresponding operation of the string
1.print (' hello ') print two times for Hello
2. Get the string by index, same as the slice operation of the list
Print (' Hello ' [2:]) Prints the result to Llo
3.print (' 0 ' in ' hello ') determines whether the content is printed in a string with a Boolean value of Ture or False
4. Formatting strings
Print ('%s is a good teacher '% ' Alex ') prints the result: Alex is a good teacher
5. String concatenation:
The string in Python is represented in the C language as a character array, and each time a string is created, it needs to open a contiguous space in memory, and once you need to modify the string, you need to make room again, and the + sign will re-open a space within it each time it appears.
A= ' 123 '
b= ' abc '
C=a+b
Print C
A/b variable, generating a new variable c = ' 123abc '
C= '. Join ([A, b]) print (c) Join as a string built-in method
6.python--The built-in method of the string (Python is already written, call directly)# print (S.center (50, ' # ')) # Center
Print (St.count (' L ')): Number of statistical elements
Print (St.capitalize ()): Capitalize first letter
Print (St.center (50, ' # ')): Centered
Print (St.endswith (' Tty3 ')): Determines whether to end with a certain content
Print (St.startswith (' he ')): Determines whether to start with a content
Print (St.expandtabs (tabsize=20)): Tab key relationship to space bar
Print (St.find (' t ')): finds the first element and returns the index value
Print (St.format (name= ' Alex ', age=37)): Another way to format the output
Print (St.format_map ({' name ': ' Alex ', ' age ': 22})): Same as above, except input parameters are different
Print (St.index (' t ')): Find index value, no error found
Print (' ASD '. Isalnum ()): Determines whether a combination of numbers and letters (kanji can)
Print (' 12632178 '. Isdecimal ()): Determines whether it is a decimal number
Print (' 1269999.uuuu '. IsNumeric ()): Determines whether a number
Print (' abc '. isidentifier ()): Determines whether illegal characters
Print (' ABC '. Islower ()): Determines if all lowercase
Print (' ABC '. Isupper ()): Determines whether all uppercase
Print (' E '. isspace ()): Determines whether it is empty
Print (' My title '. Istitle ()): Determines whether it is like a title (capitalized in the first letter of each word)
Print (' My tltle '. Lower ()): Uppercase to lowercase
Print (' My tltle '. Upper ()): Lowercase to uppercase
Print (' My tltle '. Swapcase ()): uppercase to lowercase, lowercase to uppercase
Print (' My tltle '. Ljust (50, ' * ')): output string Left
Print (' My tltle '. Rjust (50, ' * ')): Right
Print (' \tmy tltle\n '. Strip ()): Remove front and back invisible (spaces, line breaks, tabs)
Print (' \tmy tltle\n '. Lstrip ()): Remove left invisible
Print (' My title title '. Replace (' itle ', ' lesson ', 1) '): replace (1 is the number of replacements)
Print (' My title title '. RFind (' t ')): Search from right to left, index value unchanged
Print (' My title title '. Split (' I ', 1) '): Split, splits the string into a list (joins the list composition string)
Print (' My title title '. Title ()): Capitalize first letter
Loops (Loop)
Limited cycles: Number of times limit------for loop for a finite loop
Infinite loop: = Dead loop
For loop
For I in range ()
I is a custom variable
Range () can be replaced with a list, a tuple
Flag bit
Break and Continue
List
Increase
A.append () Add value of content (default tea as to last position)
A.insert (Index, "content") index is indexed, subscript
By deleting
A.remove ("content") List-in-value method
A.pop (index) based on so deleted, the deleted value can be returned
Del A[index] del A can delete a variable (object) directly
A.clear () empty
Change
a[index]= "New value" a[index1,index2]=["," "
Check
Slice:
Print (A[1:3]) gets the second and third values
Print (A[1:3:1]) is taken from left to right, and the last 1 represents the step
Print (A[1:-1]) takes the second-to-last value
Print (A[1::-1]) from right to left
A.count () query the number of occurrences of an element by using the Count method
A.index () find element position by index (find location by content)
Sort
A.sort () sort from small to large
A.reverse () Reverse
Identity judgment
Is
Type (a) is List
Python Learning Note 2