Created
February 14, 2013 00:12
-
-
Save samatt/4949621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#my first python program | |
import sys | |
#searchString = 'a' | |
#trString = 'e' | |
def translator(w): | |
return w.replace(searchString,trString) | |
searchString = sys.argv[1] | |
trString = sys.argv [2] | |
for letter in searchString: | |
letter = searchString[1] | |
print letter | |
for line in sys.stdin: | |
line = line.strip() | |
#make a list of words from the line in stdin | |
words = [w for w in line.split(" ")] | |
# translate each word in that line | |
translated = [translator(w) for w in words] | |
print " ".join(translated) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment