Python Quick Start

Source: Internet
Author: User

Python Quick Start
Python mainstream version 2.6 \ 71. CentOS view Python version

[Root @ host ~] # Python-V # view python version number Python2.6.6

 

2. Enter the Python Command Line Mode
>>> Print "hello world" # print hello worldhelloworld

 

3. How to compile a Python script
[Root @ host python] # cat test. py #! /Usr/bin/env python # can also be used #! /Usr/bin/pythonprint "hello world" # print hello world

 

4. How to run a Python script
[Root @ host python] # python test. py # first execution method helloworld [root @ host python] # chmod 755 test. py # method 2 [root @ host python] #. /test. pyhelloworld

 

5. How to import modules
>>> Import test [root @ host python] # lstest. py test. pyc # generates a file named test. pyc, because python has installed a virtual machine compiler, which reads the code I wrote, converts it to the C language, and then runs it on the system. When I import the test. py module, it will be converted to the C language.

 

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.