程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Input and output in Python [easy to understand]

編輯:Python

Hello everyone , I meet you again , I'm your friend, Quan Jun .

Python2.x edition :

1. raw_input:

Format :result = raw_input(‘ Prompt information ’)

function : Will wait for user input , Until the user presses Enter, The content entered by the user will be regarded as ” character string ”, Variables passed to the receiver

2. input:

Format : result = input(‘ Prompt information ’)

function : Will wait for user input , Until the user presses Enter, The content entered by the user will be regarded as “ Code ” To deal with !

Python3.x edition :

stay Python3.x There is no raw_input function , Only input function . here input function ==raw_input function . The input content will be input as a string .

stay 3.x How to implement in version 2.x In version input Function? ?

Use input function +eval function

Python2.x In the version

It uses print sentence :print xxx

Output a variable :print Variable name

Output multiple variables :print Variable name 1, Variable name 2

Python3.x In the version

It uses print function :print(xxx) print Functions are more powerful , There are many parameters .

Output a variable :print ( Variable name )

Output multiple variables :print ( Variable name 1, Variable name 2)

Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/147182.html Link to the original text :https://javaforall.cn


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved