Print Combining Strings and Numbers

后端 未结 5 771
野趣味
野趣味 2020-11-28 22:26

To print strings and numbers in Python, is there any other way than doing something like:

first = 10
second = 20
print \"First number is %(first)d and second         


        
5条回答
  •  自闭症患者
    2020-11-28 22:44

    if you are using 3.6 try this

     k = 250
     print(f"User pressed the: {k}")
    

    Output: User pressed the: 250

提交回复
热议问题