Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- if len(sys.argv) < 2:
- coderaw = raw_input("No program selected; input code: ")
- else:
- try:
- f = open(sys.argv[1], 'r')
- except IOError:
- print "File not found, aborting."
- raw_input()
- exit()
- f_ = True
- coderaw = f.read()
- output = ""
- for char in coderaw:
- if char == ">":
- output += "G "
- elif char == "<":
- output += "GG "
- elif char == ".":
- output += "GGG "
- elif char == "+":
- output += "GGGG "
- elif char == "-":
- output += "GGGGG "
- elif char == ",":
- output += "GGGGGG "
- elif char == "[":
- output += "GGGGGGG "
- elif char == "]":
- output += "GGGGGGGG "
- print output
- with open(sys.argv[1], 'w') as stream:
- stream.write(output)
- raw_input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement