Skip to content

Instantly share code, notes, and snippets.

@ryszard
Created January 12, 2010 15:04
Show Gist options
  • Save ryszard/275260 to your computer and use it in GitHub Desktop.
Save ryszard/275260 to your computer and use it in GitHub Desktop.
>>> 'ala ma kota'.replace(' ', r'\ ')
'ala\\ ma\\ kota'
>>> list('ala ma kota'.replace(' ', r'\ '))
['a', 'l', 'a', '\\', ' ', 'm', 'a', '\\', ' ', 'k', 'o', 't', 'a']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment