+ 1
Python considers blank or white spaces as a charector or not?
Or that question its answer was wrong? str = "hello friends" print (str[0]+str[8]) # hi //counted the space also.
4 Answers
+ 8
you can use the string method isspace() to check if a a tring is completely built of spaces or if a single character is a space. Whitespaces recognized by the function are:
space, tab, newline, carriage return, vertical tab, form feed
But there are some more whitespaces in unicode like nonbreaking space and so on. Normally these are not used in coding environments, but by doing copy & paste from the web or from a text processing app you can get these characters in your code.
+ 6
Az.A. it fails on isalpha()
Could u mean this?
+ 5
Yes it does.
hellofriends
and
hello friends
are different.
+ 1
Oma,
I can remember that some where else did not count it as char..you alright as in string the case is different.. Do you know where else it is not counted?