Python-轻松将文本文件内容转换为字典值/键
发布于 2021-01-29 14:57:10
假设我有一个包含以下内容的文本文件:
line = "this is line 1"
line2 = "this is the second line"
line3 = "here is another line"
line4 = "yet another line!"
我想将它们快速转换为字典键/值,并以“ line *”作为键,将引号中的文本作为值,同时还要删除等号。
用Python做到这一点的最佳方法是什么?
关注者
0
被浏览
58
1 个回答