Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the python print command

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report