我一直在谷歌搜索,我找不到解决方案。有人请分享一个有效的例子吗?
import easygui
#Multi Enter Box
fieldNames1= ['Situation:(Example: Waiting for a friend who is late.)','Thoughts:(EXAMPLE: My friend Bob is always late!)','Emotions:(EXAMPLE: Mad & Stressed)','Behavior:(EXAMPLE: Arguing with family)']
#Write to file
file = open('Log.txt', 'a')
file.write(feildNames1)
file.close()
这是我正在努力解决的错误:
file.write(repr(feildNames1)) NameError: name 'feildNames1' is not defined
答案 0 :(得分:3)
这是一个拼写错误。
您正在设置fieldNames1
变量,但在repr()
上调用feildNames1
。请注意e
和i