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''')line1line2line3Null 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: