Do you want to know the information about “count number of spaces in string python”. If yes, you’re in the correct tutorial.
count number of spaces in string python
# '.isspace() ' return True of False for if a character is a space word = "How many spaces" num = 0 for i in word: if(i.isspace() == True): num += 1 print(num) #Output: '2'
I hope this tutorial helps you to know about “count number of spaces in string python”. If you have any doubts regarding this tutorial please let us know via the comment section. Share this article with your friends & family via social networks.