Remove Whitespace from Text in Python

the strip() function deletes white spaces from the beginning or from the end of a string.

strip() method

a = "Hello, its time to learn, LearDuty "
print(a.strip())

Output:

Hello, its time to learn, LearDuty

Bilel

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x