python读写列排列的txt数据

python读写列排列的txt数据

读写

path='/home/uisee/Documents/dockerfiles/r.txt'
outputpath='/home/uisee/Documents/dockerfiles/show/r.txt'

fIn  = open(path)
fOut = open(outputpath,"+w")
lines = fIn.readline()

x = 0
y = 0
z = 0
while lines:
    if not lines:
        break
    all = lines.split() 
    print(all)

    fOut.write(str(all[1]))
    fOut.write(" ")
    fOut.write(str(all[2]))
    fOut.write(" ")
    fOut.write(str(all[3]))
    fOut.write("\n")

    lines = fIn.readline()
fIn.close()
fOut.close()

你可能感兴趣的:(python)