欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決python中的print函數(shù)自動(dòng)換行的問題

 更新時(shí)間:2024年02月04日 08:58:20   作者:二木成林  
這篇文章主要介紹了解決python中的print函數(shù)自動(dòng)換行的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

print函數(shù)自動(dòng)換行問題

print()函數(shù)自動(dòng)換行

解決這個(gè)問題

查看print()函數(shù)的源碼:

因此解決方法就是將end參數(shù)設(shè)置為空字符串即可。

Python print函數(shù)常用輸出格式

1.a,b賦值

a = 1.0b = 2.0

2.直接輸出

print(a, ' and ', b)
print('{} and {}'.format(a, b))
print('{} and {}'.format('1.0', '2.0'))
1.0  and  2.0
1.0 and 2.0
1.000 and 2.00

3.按照指定小數(shù)位數(shù)輸出

print('{:.6f} and {:.5f}'.format(a, b))
print('%.6f and %.5f'%(a, b))
print('%s and %s'%('1.000000', '2.00000'))
1.000000 and 2.00000
1.000000 and 2.00000
1.000000 and 2.00000

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論