Skip to content
Snippets Groups Projects
Commit f4fc27f2 authored by 최정민's avatar 최정민
Browse files

Fixed bug now delete all files in directory

parent b8fa65fb
No related branches found
No related tags found
No related merge requests found
from os import listdir, unlink
from os.path import isfile, join
import re
import numpy as np
class FileParse:
......@@ -10,6 +9,12 @@ class FileParse:
def fileCount(self):
return len(listdir(self.folderPath))
def removeFile(self,file_path):
try:
unlink(file_path)
except Exception as e:
print("failed to delete")
def read(self):
file_list = listdir(self.folderPath)
data = ""
......@@ -19,10 +24,8 @@ class FileParse:
if i==(len(file_list)-1):
f = open(file_path, "r")
data = f.read()
try:
unlink(file_path)
except Exception as e:
print("failed to delete")
f.close()
self.removeFile(file_path)
result = []
samples = data.splitlines()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment