创建索引文本文件 [英] Create index text file

查看:82
本文介绍了创建索引文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有5个文本文件.每个文件中的每个记录都包含两个字段,即city和salefigure.
我需要在文本文件中创建索引.

I have 5 text file. each record in each file contains two fields, city and salefigure.
i need create index in text file.

推荐答案

根据Mathlab的注释,您可以尝试将所有5个文本文件读取到哈希表/字典中.逐行阅读它们,将每一行拆分为键和值,然后将其添加到字典中.键值必须是一个列表,因为一个城市可能会有更多的销售数字.然后将字典写入文本文件.
According to Mathlab´s comment you can try to read all 5 text files to a hashtable/dictionary. Read them line by line, split each line into key and value and add them to the dictionary. The keys value has to be a list, because there may be more salesfigures for a city. Then write the dictionary to a text file.


这篇关于创建索引文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆