我想读取一个特定的txt文件,从中获取数据并将其写入元组。问题是我不需要文件中的所有数据,只需要特定的数据。 因此文本文件如下所示:
HHSDMSDN1-pool 1.02T 141G 39 22 2.62M 940K
**c5t600507680C800000001CBd0 834G 118G** 32 16 2.19M 734K
**c5t600507680C00352d0 216G 22.3G** 7 5 434K 206K
HHSDMSDN2-pool 1.09T 308G 12 6 744K 83.8K
**c5t600507680C800001CDd0 790G 162G** 10 1 617K 12.5K
**c5t600507680C8000000037Dd0 203G 34.8G** 1 0 123K 10.2K
**c5t600507680C800000387d0 126G 112G** 0 5 5.36K 80.5K
HHSDMSDN3-pool 1.13T 33.4G 24 19 1.39M 623K
**c5t600507680C80002E6000001CFd0 921G 30.8G** 18 11 1.10M 465K
**c5t600507680C80002E600000203d0 235G 2.63G** 5 8 293K 158K
粗体文本需要进入元组。如果第一个值是string,而下两个值是double/float,则为最佳。你知道吗
所以输出将是
((c5t600507680C800000001CBd0, 834, 118), (c5t600507680C00352d0, 216, 22.3), .....))
有什么想法吗?你知道吗
您只需逐行遍历文件并跟踪您已经看到的内容。你知道吗
编辑:根据要求新建解决方案
输出:
相关问题 更多 >
编程相关推荐