python-Basic Primer-2

Source: Internet
Author: User

Here are two, equivalent to the scanf function in C

The first of the Raw_input

1 age=raw_input ("")2print"You are%d" Old. " % Age

When the raw_input is encountered, the program's run will abort, popup the string in parentheses, the value you entered will be assigned to the previous variable

A second argv

1  fromSysImportargv2 3Script, name, tall, weight =argv4 5 Print "The script is called:", Script6 Print "Your name variable is:", name7 Print "your tall variable is:", Tall8 Print "your weight variable is:", weight

The From ****import*** is the call library and will often encounter

ARGV Saves the arguments you enter when you run the variable and takes it out of the object.

The first one is script, which is the name of the scripts, and then the three variables that were entered are assigned to Name,tall,weight.

At run time, arguments follow the script name.

python-Basic Primer-2

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.