Python's first script

Source: Internet
Author: User

1 A First Script

1) script1.py

1 #A First Python script2 ImportSys#Load a library module3 Print(Sys.platform)4 Print(2 * * 10)#Raise 2 to a power5x ='spam!'6 Print(x * 8)#String Repetition

This file:

- Imports a Python module (libraries of additional tools), to fetch the name of the platform

-Runs Three print function calls, to display the script ' s results

-Uses A variable named X, created when it's assigned, to hold onto a string object

-Applies various object operations that we'll begin studying in the next chapter

2) Run file

Once Save this text file, run it by listing-it full filename as the first argument-a python command, typed at the Syst EM shell prompt:

% python script1.py

The output result in My computer is

linux21024spam! spam! spam! spam! spam! spam! spam! spam!

Python's first script

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.