Python variable, code base day-1

Source: Internet
Author: User

1. Version differences


Python code--bytecode--machine--Computer
PyPy code-to-machine code--Computer
CPython is the official version of Python

#!/usr/bin/env python
#-*-Coding:utf-8-*-

The. pyc file is a byte-code file, which is equivalent to a caching mechanism

2. Variables

1. A variable refers to something

2. Composed of numbers, underscores, letters (note: Cannot start with a number)

3. Cycle

1.if, after else,elif2017-07-15 condition must remember add:

2.while cyclic generation conditions will always be met. Break can force the loop to jump out, continue means exiting the loop and entering the next loop.

4. Encoding

1.UTF-8,GBK is the simplification of the universal code

2. If you want to convert Utf-8 to GBK, you need to convert to Unicode first.

If A is utf-8, convert it to GBK:

A = A.decode ('utf-8'# decoding needs to specify what type of encoding is originally a = A.encode ('GBK  ')   # encoding needs to specify what type of encoding you want to turn into

Python variable, code base day-1

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

  • 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.