0

Which method can be used to remove any whitespace from both the beginning and the end of a string?

21st May 2019, 6:19 AM
RedwineđŸ·đŸ»
RedwineđŸ·đŸ» - avatar
3 RĂ©ponses
0
If str is your string variable Check for str.strip() https://docs.python.org/2/library/stdtypes.html#str.strip
21st May 2019, 6:30 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
0
Prokopios Poulimenos It is not recommended to use functions (e.g. str) as variable names as it can mess up with your code. Python 3 Documentation. https://docs.python.org/3/library/stdtypes.html#str.strip
21st May 2019, 6:52 AM
Diego
Diego - avatar
0
@Diego It was just an example.
21st May 2019, 6:57 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar