Python 中的 string.whitespace


在本教程中,我們將瞭解string.whitespace

字串whitespace在Python 3 的string 模組中進行了預定義。它包含空格、製表符、換行符、回車符、換頁符垂直製表符

示例

 即時演示

# importing the string module
import string
# printing a string
print("Hello")
# whitespace printing
print(string.whitespace)
# printing a string
print('tutorialspoint')

輸出

如果你執行以上程式碼,就會得到以下結果。

Hello

tutorialspoint

結論

如果本教程存在任何疑問,請在評論部分中提出。

更新日期:2020 年 7 月 11 日

324 次瀏覽

開始你的 職業生涯

完成課程即可獲得認證

開始
廣告
© . All rights reserved.