1

I am trying to write a function to check for trail whitespace, but not to remove the spaces. but i have no idea of how to do that. can somebody teach me?

thank you

falsetru
  • 357,413
  • 63
  • 732
  • 636
Joyce Lam
  • 33
  • 1
  • 4

1 Answers1

5

Using str.endswith:

>>> 'with trailing space  '.endswith(' ')
True
>>> 'without trailing space'.endswith(' ')
False
falsetru
  • 357,413
  • 63
  • 732
  • 636