my current code does:
- open .dat file, split them into smaller .dat files by group
newpath = r'C:\Users\DELL\Desktop\python split\462888'
if not os.path.exists(newpath):
os.makedirs(newpath)
with open('462888//462888.dat', 'a', encoding='utf-8') as outfile:
for filename in path.glob(f"*{extension}"):
with open(filename, encoding='utf-8') as infile:
for line in infile:
if '4628 88' in line:
outfile.write(line)
what i want to do:
how do i move the opened .dat files into a new folder after it finished processing into smaller .dat files to avoid duplication.