Suh基本上有一个文本文件,里面有许多超速的违法者的地址、姓名和车辆登记信息。文本文件中的一条记录如下所示:
reg: TW04AND
name: Karlie Kloss
address: 1 Hotstuff Road, BD7 4BT, Bradford
然后是另一个文件,包含另一组结果,地址刚刚超过标准车牌登记的速度限制,条目如下所示:
114mph = WE64NGL
或者
78mph = XD01SMH
这样它就可以比较这两个文件,并产生另一个文件与再犯罪者。我知道如何创建一个新的文本文件,但它的比较和输出,我挣扎和我感谢如果有人能帮助我。提前感谢:)
学习如何用python读取文本文件是一个快速的搜索过程,但是无论如何,这里有一个适合您的文件结构的代码示例。你知道吗
遵循这个结构
下面的代码将读取文本文件并为每个数据集创建一个包含字典的列表。你知道吗
看起来您可以将两个文件中的所有数据读入字典,并使用图版作为密钥存储罪犯信息。然后按车牌搜索,根据需要检查之前是否发生过超速事故。你知道吗
相关问题 更多 >
编程相关推荐