如何修复 - TypeError:write()参数必须是str,而不是None

时间:2017-02-23 19:21:09

标签: python

这是我的代码 -

sentence = input("Enter a sentence without punctuation")
sentence = sentence.lower()
words = sentence.split()
pos = [words.index(s)+1 for s in words]
hi = print("This sentence can be recreated from positions", pos)
print(hi)

saveFile = open("exampleFile.txt" , "w")
saveFile.write(hi)
saveFile.close()

但是我得到错误 - TypeError:write()参数必须是str,而不是None 我不知道如何解决它

0 个答案:

没有答案