我有一个文本文件,我需要将其转换为列表。这里的数据格式的文本文件:数据转换为数据结构
'ID=s4k5jk\nDate=8 December 1970\nTitle=crossing the atlantic on a tricycle\nID=f983\nDate=22 December 1970\nTitle=Royal Episode 13'
我需要的输出看起来像这样
l = [
#ID Date Title
["s4k5jk", "8 December 1970", "crossing the atlantic on a tricycle"],
["f983", "22 December 1970", "Royal Episode 13"]]
是否有人可以让我知道如何转换这样的列表的形式?非常感谢!
你想要的结果是什么? – zondo
@zondo我想要的结果是打印一个列表L(见上面的输出),我刚刚从文本文件 – Sophie
中加入了原始数据那不是字典;这是一个列表。那是你要的吗? – zondo