先随便写个自己写的程序,显得高大上,此程序作用是把文件转换为列表
new = []
with open("Information.txt","r",encoding="utf8") as file:
for line in file.readlines():
new.append(line.strip().split(","))
print(new)
先来个有序字典,使用了collections模块。
In [60]: ol = collections.OrderedDict() In [61]: ol["k1"] = "v1" In [62]: ol["k2"] = "v2" In [63]: print ol OrderedDict([('k1', 'v1'), ('k2', 'v2')])