问题
如何编写代码,在输出中插入插入断行,输入中有一个?
代码
data1=[]
with open("FileInput1.txt") as file:
for line in file:
data1.append([float(f) for f in line.strip().split()])
data2=[]
with open("FileInput2.csv") as File2:
for line in File2:
data2.append([f for f in line.strip().split()])
样本输入:
文件输入#1
1223 32 (userID - int = 1223, work hours = 32) 2004 12.2 8955 80
一个。电流输出
1223 32 2004 12.2 8955 80
文件输入 2:
UserName 3423 23.6 Name 6743 45.9
一个。电流输出
UserName 3423 23.6 Name 6743 45.9