Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想编写一个 Python 程序,它能够从字典中读取任何(或大多数)文本框。这可能吗?我将如何处理它?
这是我的意思的示例,第一行是我希望能够键入以接收第二行的命令示例,这将是存储在字典值中的消息:
/alias hello HELLO! THIS IS AN AUTOMATED REPLY! :D
将字典存储为 {key:value} 形式的键值对。在关键部分写下你的命令,比如“你好”,在值部分写下你的相应消息,比如“你好!这是自动回复!:D'。您可以从其键中访问您的值。例如:
abc = {"hello" : "HELLO! THIS IS AN AUTOMATED REPLY! :D"} print abc["hello"]
它将打印“你好!这是一个自动回复!:D”。
我想这就是你的意思。其实我还没明白你说的文本框是什么意思..