我想为 python 代码示例创建类似字典的东西。我的问题是,我必须转义所有代码示例。也r'some string'
没什么用。您是否建议使用其他解决方案来查询此条目?
import easygui
lex = {"dict": "woerter = {\"house\" : \"Haus\"}\nwoerter[\"house\"]",\
"for": "for x in range(0, 3):\n print \"We are on time %d\" % (x)",\
"while": "while expression:\n statement(s)"}
input_ = easygui.enterbox("Python-lex","")
output = lex[input_]
b = easygui.textbox("","",output)