Python learning notes (1), python learning notes (

Source: Internet
Author: User

Python learning notes (1), python learning notes (

 
>>> print('The quick brown fox', 'jumps over', 'the lazy dog')The quick brown fox jumps over the lazy dog

print()Each string is printed in sequence, and a comma (,) is used to output a space. Therefore, the output string is combined as follows:

name = input('please enter your name: ')print('hello,', name)
 

First print the outputplease enter your name:In this way, the user can enter the name as prompted and gethello, xxxOutput:

 

Finally, be sure to note that the Python program is case-sensitive. If the case is incorrect, the program reports an error.

If a string contains many line breaks, use\nIt is not easy to read in a row. to simplify it, Python allows'''...'''Multi-line content

>>> print('''line1... line2... line3''')line1line2line3
Null Value

A null value is a special value in Python.None.NoneCannot be understood0Because0Is meaningful, andNoneIs a special null value.

# -*- coding: utf-8 -*-
> 'Hi, %s, you have $%d.' % ('Michael', 1000000)
If you are not sure what to use, %sIt always works and converts any data type to a string:

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.