python 打印/輸入語句的使用


print("Hello World!")
print("hello" * 3)          # 輸出3個hello
 
print("Hello", "World!")    # 中間一個空格分隔
 
print("多行語句 \
      分割")
 
print("換行 \n  符")        # 換行符
 
print("第一列\t第二列")
 
print("不換", end="")
print("")
 
print("a={},b={}".format(1, 2))     # a=1, b=2
print("a=%s,b=%s" % (1, 2))
 
input = int(input("請輸入喜歡的數字:"))
print("輸出:", input)

運行結果:

Hello World!
hellohellohello
Hello World!
多行語句       分割
換行 
  符
第一列    第二列
不換行
a=1,b=2
a=1,b=2
請輸入喜歡的數字:3
輸出: 3

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM