path='C:\\Users\\HUANGJINLONG407\\Downloads\\roadmap.xlsx'
data=pd.read_excel(path,encoding='gbk')
###设定每列的字符宽度
mat = "{:35}\t{:35}\t{:35}"
def dk(x,mat):
bb=mat.format(str(x[0]).strip(),str(x[1]).strip(),str(x[2]).strip())
return bb
new_dd=data.apply(lambda var:dk(var,mat),axis=1)
new_dd=pd.DataFrame(new_dd)
new_dd.columns=[mat.format(str('caller').strip(),str('callee').strip(),str('weight').strip())]
new_dd.to_csv("C:\\Users\\HUANGJINLONG407\\Downloads\\test.txt", sep='\t',index=False, header=True)