[python] txt 파일 읽고 수정하기
·
파이썬
import os import shutil import json rootpath = "/hdd/street_obstacle/train/" file_lst = os.listdir(rootpath) for file in file_lst: if file.endswith(".txt") : edited_lines ="" with open (rootpath+file) as f : for t in f.readlines(): string = t.split(' ') ans = float(string[0]) ans = int(ans) -1 ans = str(ans) edited_lines =edited_lines+ ans for i in range(len(string)-1): edited_lines = edited_lin..