First contact with Python, starting from the basics of zero. ends with a. PY name and facilitates identification. internal execution Order Yes-read-in memory-lexical analysis-parsing-compiling (bytecode)-Execution (machine code)-CPU read interpreter: #! /usr/bin/env python content encoding: The default is Ascill (up to 256 symbols only) Unicode (minimum 16 Bit) UTF-8 (another processing of the unicod e, Save space) Coding:utf-8 c language: code compilation get machine code   machine code executes directly on the processor, each instruction controls CPU work other languages: code compilation gets byte code The virtual machine executes the bytecode and translates it into machine code and then executes execute on the processor every time. Py's Python footsteps, the system automatically generates a. pym file, executed sequentially when the source py file is not modified. Pym will be executed first, when the source py file changes, the system will be different than the discovery will first execute the. py file. variable naming: Numbers, letters, underscores, numbers cannot be named as the first, avoid some keywords in python such as is variable assignment: For string assignment,name2=name1 modify name1,name2 unchanged. Evil +: The more strings, the more repetitive the memory opens up. Single value: Number (integer, long shape, floating point, plural), Boolean (TRUE1,FALSE0) string collection: list, meta-ancestor, dictionary, hash table string common functions: Remove blank, split, length , index, slice list: index, slice, append, delete, length, slice, loop, include Ganso: Index, slice, followRing, length, including Dictionary (unordered): Index, new, delete, key, value, key-value pair, loop (range,continue and break), length basic operation of the initial text open file: File_obj = file ("File path", "mode") Open file mode is: R, open file as read-only W, open a file for writing only. Overwrite the file if it already exists. If the file does not exist, create a new file. A, open a file for append. If the file already exists, the file pointer will be placed at the end of the file. In other words, the new content will be written to the existing content. If the file does not exist, create a new file to write to. w+, open a file for read-write. Overwrite the file if it already exists. If the file does not exist, create a new file.
Python first day