Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the python print command

Shulou Source: shulou.com Published: 2022-06-01 06:33:28 10月02日 Update

This article introduces the knowledge of "how to use python print commands". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

For example:

Test1 = ['axiajiaoyuanb']

Test2 = [1BI 2]

Test3 = 521

Print (test1,test2,test3)

Output result:

H:\ 2019\ untitled\ venv\ Scripts\ python.exe Hazard 2019 / untitled/day03/test1.py

['await,' b'] [1,2] 521

Example 2: print Xiao Wang saw an angel on the rooftop

Name = input ("enter your name:")

Address = input ("Please enter a location:")

Name2 = input ("Please enter a second location:")

Print ("s went to s yesterday and saw s" (name,address,name2))

Output result:

Please enter your name: Xiao Wang

Please enter a location: rooftop

Please enter the second location: Angel

Xiao Wang went to the rooftop yesterday to see an angel.

% s is a formatted output, and above version 3.6,% s is used more and more frequently. If you do not need to format input, you need to use string concatenation, which is very troublesome.

If you have zero foundation, start with imitation, click again, and if there is something wrong with the execution, modify it until it is successful, and then modify it on the basis of it after the successful implementation. There is no need to modify it too complicated, such as changing the text to what you want to print.

Assignment:

Print the following figure:

This is the end of the content of "how to use python print Command". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Input content location output angel Xiao Wang rooftop command success name foundation more format knowledge result complex practical frequent successful learning next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Information Shulou Tech Info MySQL MariaDB