String Whitespace in Python



In this tutorial, we are going to learn about the string.whitespace.

The string whitespace is pre-defined in the string module of Python3. If contains space, tab, linefeed, return, formfeed, and vertical tab.

Example

 Live Demo

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

Output

If you run the above code, then you will get the following result.

Hello

tutorialspoint

Conclusion

If you have any doubts in the tutorial, mention them in the comment section.

Updated on: 2020-07-11T07:56:31+05:30

355 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements