Skip to content

Instantly share code, notes, and snippets.

@lqc
Forked from ryszard/gist:275260
Created January 12, 2010 15:07
Show Gist options
  • Save lqc/275264 to your computer and use it in GitHub Desktop.
Save lqc/275264 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']
>>> print('ala ma kota'.replace(' ', r'\ '))
ala\ ma\ kota
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment