Python's Way "first": Python Basics (2)

Source: Internet
Author: User
Input and Raw_input Python 3.5 input inputs, regardless of whether the input is a number or a string, are implicitly considered a string, if you want to enter a number to convert a string into a number, use the Int method. Python 2.7 in the input string with input by default, the input is the variable, and then go to find this variable, and will not find and then error, enter the number of Python think the input is the number will be saved, so will not error. If you enter a string, you need to use raw_input instead of input, which appears only in 2.7. Use placeholders in text format: Insert the%s%d%f placeholder in the text, and then use the% (name,age,job)%s string%d numeric%f floating point number solution: Convert the string to digital age = Int (input ("Yo ur input age: "))

Python's Way "first": Python Basics (2)

Related Article

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.