txtファイルのカラムデータを抽出し、txtファイルとして保存

448 ワード

import sys
path = "./001.txt"   #    
f = open(path)
line = f.readline()
list = []
while line:
    a = line.split( )
    b = a[1:]
    list.append(b)
    line = f.readline()
f.close

with open('002.txt', 'a') as month_file:    #        
    for tag in list:
        for i in tag:
            month_file.write(str(i))
            month_file.write(' ')
        month_file.write('
')