Skip to content Skip to sidebar Skip to footer

How Do I Change A Python Interpreter From English To My Dialect

I have been stuck for months trying to edit the python interpreter (from www.python.org). All I want to do is to change the keywords eg. change from. English language: print() to I

Solution 1:

Use regular expressions in another script to parse your main script:

import re

old = open('main.py')
data = old.read()
old.close()

data = re.sub(r'\bde\b', 'print', data)
# continue to replace other keywords

new = open('main.py', 'w')
new.write(data)
new.close()

Post a Comment for "How Do I Change A Python Interpreter From English To My Dialect"