Python基礎(chǔ)入門(mén)教程11:程序編程基礎(chǔ)之輸入輸出
來(lái)源:
奇酷教育 發(fā)表于:
python中的輸入輸出,在初學(xué)python的時(shí)候是比較有用的一個(gè)交互操作方式1 數(shù)據(jù)輸出2 數(shù)據(jù)輸入3 python中的輸入輸出python提供了3種輸入
python中的輸入輸出,在初學(xué)python的時(shí)候是比較有用的一個(gè)交互操作方式
1 數(shù)據(jù)輸出

2. 數(shù)據(jù)輸入

3. python中的輸入輸出
python提供了3種輸入輸出標(biāo)準(zhǔn)文件對(duì)象,分別為標(biāo)準(zhǔn)輸入、標(biāo)準(zhǔn)輸出和標(biāo)準(zhǔn)錯(cuò)誤;分別對(duì)應(yīng)了sys模塊中的sys.stdin,sys.stdout,sys.std.err。

4. 擴(kuò)展:格式化輸出
print()函數(shù)可以通過(guò)指定格式來(lái)輸出對(duì)應(yīng)的數(shù)據(jù)
語(yǔ)法

這里的%format表示格式化占位字符,variable表示用于替換占位字符的變量

% 后面緊跟著的就是格式化字符,語(yǔ)法結(jié)構(gòu)如下

常見(jiàn)的格式化字符如下:
>>>更多VR/AR入門(mén)教程:VR入門(mén)