参考原版答案
import keyword
#7.1
stopwords = '\t\n\r: ()'
functionwords = '.('
word = []
output = ''
lastAvailable = ['from', 'import']
last = False
def readFile(path):
file = open(path,'r',encoding = 'utf-8')
string = file.read()
return string[1:]
def parse(string):
global last
global word
global output
for i in string:
if i in stopwords:
wd = ''.join(word)
res = isKeyWord(wd)
if res == False:
if i not in functionwords and last == False:
wd = wd.upper()
if wd in lastAvailable:
last = True
else:
last = False
output += wd
output += i
word =