+ 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

31st May 2019, 10:26 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar
2 Respuestas
+ 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)
31st May 2019, 11:22 PM
HonFu
HonFu - avatar
+ 3
Thanks a lot HonFu
31st May 2019, 11:43 PM
Nika Soltani Tehrani
Nika Soltani Tehrani - avatar