Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

string.whitespace trong Python

Trong hướng dẫn này, chúng ta tìm hiểu string.whitespace.

Chuỗi whitespace được định nghĩa sẵn trong module string của Python 3. Chứa: space, tab, linefeed, return, formfeed, vertical tab.

Ví dụ

import string
print("Hello")
print(string.whitespace)
print('tutorialspoint')

Kết quả

Hello
tutorialspoint

Kết luận

string.whitespace chứa tất cả ký tự khoảng trắng chuẩn. Hãy bình luận nếu có thắc mắc.