Question:
How can you get the length of a string in Python, but so that spaces are not counted? For example, to make the length "99 99 99 99" equal to the length "9999 9999"
Answer:
You can do it like this: len(str.replace(" ", ""))
How can you get the length of a string in Python, but so that spaces are not counted? For example, to make the length "99 99 99 99" equal to the length "9999 9999"
You can do it like this: len(str.replace(" ", ""))