Python first day

Source: Internet
Author: User

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

Related Article

Contact Us

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: 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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.