Guest User

Untitled

a guest
Feb 12th, 2020
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. user_input = "This\nstring has\tsome whitespaces...\r\n"
  2.  
  3. character_map = {
  4.                 ord('\n') : ' ',
  5.                 ord('\t') : ' ',
  6.                 ord('\r') : None
  7. }
  8. user_input.translate(character_map)
  9. # Output: 'This string has some whitespaces... '
Advertisement
Add Comment
Please, Sign In to add comment