I need a script to extract data from multiple whitespace separated csv's.
(我需要一个脚本来从多个空格分隔的csv中提取数据。)
Following is the data that is there in each csv: (以下是每个csv中的数据:)
H 156898900 0 50K 0 6 -1 WIN002862 1 Hondrus JHUHUGHJHHHHHHHH :18:08ytrvhNN :12B:
## $$$$ :18:9ynnnhNN :12B: 98uu WIN00876 1 Hondrus
Output Needed, two columns in a dataframe, ID & MID:
(需要输出,数据帧中的两列,ID和MID:)
[ID MID
08ytrvhNN 002862
9ynnnhNN 00876][1]
Using the below code which is not working---
(使用以下无效的代码-)
import glob
files = glob.glob('*.csv')
strings = []
for file in files:
with open(file, "r", encoding='UTF-8') as fobj:
text = fobj.read()
import re
a = re.compile(':18:(.*) :12N:')
b=re.compile('WIN(.*)Hondrus')
z = a.findall(text)
k=b.findall(text)
strings.append(z[0] + "," + k[0])
ask by Ryan translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…