Skip to content

Instantly share code, notes, and snippets.

@KorbenC
Created April 3, 2014 15:03
Show Gist options
  • Select an option

  • Save KorbenC/9956040 to your computer and use it in GitHub Desktop.

Select an option

Save KorbenC/9956040 to your computer and use it in GitHub Desktop.
Write a method that replace all spaces in a string with '%20'
#!/usr/bin/env python
import sys
str = 'The knights who sy ni!'
for char in str:
if char == ' ':
str = str.replace(' ', '%20')
print str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment