我有一个看起来像这样的文本文件:
This is a text file
game:
"
a
b
"
symbol : "o"
我想使用“game:”旁边和引号之间的行。 我尝试使用 re 例如:
contents = file.read()
re.findall((?<=game)"([^"]*)",contents)
但这行不通... 有人能帮助我吗? 谢谢!
请您参考如下方法:
您需要考虑 game: ":
re.findall(r"game: \n\"\n([^\"]*)",contents)
