Python基礎 輸入輸出

2022-05-27 02:15:10 字數 604 閱讀 9848

輸出:

print()如果要在一行中輸出多個值,那麼輸出的n個值分別使用逗號隔開

例如:

print(val1,val2)

輸入:

raw_input("

some description!

") #

python 2.7語法

input("

some description!

") #

python 3.x語法

輸入密碼:

先導入getpass模組,然後再使用getpass模組的getpass("some description")方法獲取輸入密碼

import

getpass

getpass(

"some description

")

標準輸出

import

syssys.stdout.write()

上面**和print的區別:write輸出不換行

python基礎 輸入輸出

input print 知識點 1.input預設接收使用者輸入內容為字串型別 2.print直接輸出字串內容 card id input 請輸入學號 pwd input 請輸入密碼 print card id print type card id print pwd 1.print列印字串 pri...

Python基礎 輸入輸出

基本格式 常用格式化字元 含義 s 字串 d 有符號十進位制的整數,06d 輸出的整數顯示位數,不足的地方使用0補全 f浮點數 2f表示顯示小數點的後兩位 輸出 變數輸出例項需求 定義整數變數 student no,輸出 我的學號是 000001 student no 1 print 學號是 06d...

python基礎輸入輸出

輸出 print 加上 字串就可以輸出 print 函式也可以接受多個字串,用逗號 隔開,結果 會變成空格 print 函式中可以直接進行簡單的數 算 print 字串 輸出變數 表示拼接 兩邊的變數型別必須保持一致 格式化輸出 print 字串 s,s,s 對應佔位符的內容 s佔位符 str強制轉...