There is a translation table (dictionary) above this code.
Synopsis of the code:
Converting/translating a string of characters to another character in a different ASCII/Unicode-8 character and printing this output to a new file with a user inputted name.
The input of this conversion should be a user input and should accept multiline string.
print("Enter PC2 text to convert to InPage: ")
text = sys.stdin.read()
translated = text.maketrans(translation)
finaltext = text.translate(translated)
print("Provide a name of the file:")
fileofname = input()
name = fileofname+'.txt'
with open(name, 'w') as f:
sys.stdout = f
f.write(finaltext)
I have tried the following ways to overcome this issue and none of them have worked out the way I intent it to:
- import sys
- while looping
- raw_input (python 2)
- EOF