我正在尝试制作一个程序,自动回答网站上的问题,我将答案存储在一个文件中,但我不知道如何读取文件中的符号。我需要得到的问题和答案都是粗体的
这是文件中每个问题的外观。最后的逗号是第一个问题和第二个问题之间的分界
{“填写以下语句:将状态从---(1)---更改为气体称为---(2)---”:{“['1:液体;2:蒸发”,“1:液体;2:熔化”,“1:固体;2:蒸发”,“1:固体;2:熔化]”:
“1:液体;2:蒸发”,“['1:液体;2:沉积','1:液体;2:升华','1:固体;2:沉积','1:固体;2:升华']:“1:固体;2:升华”
Tags:
假设您有文本格式的数据(即扩展名为.txt的文本文件)
您可以尝试将字符串转换为dict,然后使用dict.items()
相关问题 更多 >
编程相关推荐