author:Once Day date:2022 year 2 month 16 Japan
The purpose of this document is to summarize the relevant contents , Scattered knowledge is difficult to remember and learn .
This document is based on windows platform .
View a full range of documents :python Basics _CSDN Blog .
input function : Get user input , Save it as a character string .
>>> name = input(" Please enter your name :")
Please enter your name :>? onceday
>>>name
'onceday'
Be careful , Even if you enter a number , It will also be saved as a string !
input Function returns the user input as it is , And wrap it into a string .
input Functions can sometimes be cleverly used to block or pause programs
Used to format and display content on standard output , Mainly refers to the screen display .
print Multiple strings can be accepted , A variable of string type or can be used print The object of . Use commas for each string “,” separate , Output in series .print Each string will be printed in turn , meanwhile , Every comma “,” Just output a space .
print('aaa','bbb','ccc')
aaa bbb ccc
As for the shape print(a+"a"+b)
The sentence of , It's actually calculated first a+"a"+b
Value , And then through print Print it .print() Will automatically execute internal statements , Output the desired results .
print Prototypes of functions :print(self, *args, sep=' ', end='\n', file=None)
sep Parameters : Separated symbols , The default is a space ;
end Parameters : End method after printing , The default is line break \n
. If , Set up end=''
, You can leave the line blank , Give Way print Continuous printing in one line . Flexible use print Parameters of , Flexible printing control can be realized .
In the previous study , We hav