import pandas as pd
#读取txt文件
txt_file_path = 'data.txt'
csv_file_path = 'data.csv'
#使用pandas读取txt文件
df = pd.read_csv(txt_file_path, sep='')
#将数据写入csv文件
df.to_csv(csv_file_path, index=False)
print("f{Successfully converted {txt_file_path} to {csv_file_path}.")