Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- inputText = ''
- convertedText = ''
- def openx(data):
- inputText = inputText + data + ' '
- varx = []
- for text in data:
- if text == "\n":
- varx.append(" ")
- elif (text in ['a, b, c']):
- varx.append(','.join("2"))
- elif (text in ['d', 'e', 'f']):
- varx.append(','.join("3"))
- elif text in ['g', 'h', 'i']:
- varx.append(','.join("4"))
- elif (text in ['j', 'k', 'l']):
- varx.append(','.join("5"))
- elif (text in ['m', 'n', 'o']):
- varx.append(','.join("6"))
- elif (text in ['p', 'q', 'r', 's']):
- varx.append(','.join("7"))
- elif (text in ['t', 'u', 'v']):
- varx.append(','.join("8"))
- elif (text in ['w', 'x', 'y', 'z']):
- varx.append(','.join("9"))
- return inputText + ''.join(varx)
- def start():
- with open("/home/fear/test.txt") as file:
- xdata = file.read()
- openx(xdata)
- start()
Advertisement
Add Comment
Please, Sign In to add comment