+ 3
How can we check if a string has been terminated or not
In the case we had got a string from user,and and we want to do a function on the string also we want to repeat the function on each character of the string ,how can we check weather the string has been terminated or not
2 ответов
+ 4
Are you asking for a char array termination letter '\0' like in C?
You don't need to do that in Python, the type str can be used more conveniently.
If you want to do something with each letter, just do:
for letter in that_string:
...
You can always check for the length of the string if you need to:
len(that_string)
+ 3
Thanks a lot HonFu