txt格式为:
以下解析为csv
import numpy as np
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import os,sys
import re
os.chdir('/Users/cc/Documents/cc工作 对内生意金/05.征信版_qdy')
f1=open('zhangyibao.txt','r+')
zhang=f1.read()
zhang1=zhang.split(',') ##以逗号解析列表
char=[]
value=[]
for line in zhang1:
if not line:
break
pass
char_tmp,value_tmp=[str(i) for i in line.split('=')]
char.append(char_tmp)
value.append(value_tmp)
char1=pd.Series(char,name='charname')
value1=pd.Series(value,name='value1')
zhangyibao=pd.concat([char1,value1],axis=1)
zhangyibao.to_csv('zhangyibao.csv')