Python learning Manual: Python learning notes day 1, python learning Manual

Source: Internet
Author: User

Python learning Manual: Python learning notes day 1, python learning Manual

Obtain the current directory path:

Import OS

OS. getcwd ()

 

When entering a python program, try to keep statements that are not nested structures at the leftmost, or the system may encounter a "SyntaxError" error.

 

Obtain the system platform Name:

Import sys
Print (sys. platform)

 

Stream redirection: Export python output data to other files: python ***. py> test.txt

 

To avoid program flash on windows, add: input () at the end of the Code ()

 

Python3.x to simulate the input (evaluate the string) in python2.x, use eval (input ())

 

If you want python to run the file again in the same session (do not stop or restart the Session), you need to call the reload function in the imp standard library module (2. x is built-in, 3. x is not built-in)

From imp import reload

Reload (***)

 

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.