Python Basic Notes

Source: Internet
Author: User

This article mainly records the basics of Python.

First, Python basic input and output statements

1. Print () function: printed output. Integer, floating-point, string

Print () formatted output:

Print (Format (var,format_modifier)): var value, format_modifier format Word

such as print (Format (12.34567, ' 6.2f ')): 6 output placeholder, 2 accuracy

Print (Format (0.3456, ' 3.2% ')): 3 for placeholder, 2 for precision, left/right aligned output/output 34.56%

2, Raw_input () function: input.

Syntax: Raw_input ([Prompt]), string

So enter a number, get a string, want to become integral type, must be converted, such as Age=int (raw_input ("Input your Age:"))

conversion function: Int (), float ()

Second, the variable analysis

1, the "change" of the Python variable, the ID

You cannot modify the contents of a data cell by its variable name

2. Python data type does not need to specify type

3. Compare the C variable to the Python variable

Third, Python functions

1. The System library provides internal functions

Character function library: str

Math Library: The math library is not the default library, it needs to be imported, import math

OS Library

Network Programming Library: Socket Library

......

2. Functions provided by third parties: HTTPLIB2

Installing a third-party-supplied library procedure: Easy_install HTTPLIB2

(1)

3. Custom Functions

  

Python Basic Notes

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.