You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
txt_files_to_be_removed=[] #script needs to be inside the folder which has txt files and metadata
6
+
7
+
year_to_be_removed=['independencerepublicday'] # WHAT IS TO BE REMOVED year_to_be_removed does not matter if numerical: [1916,1917] , if string ['nehru','gandhi']
8
+
index_to_be_removed=[]
9
+
foriinrange(len(dataf)):
10
+
if(dataf.iloc[i,12] inyear_to_be_removed): #in python, column numbers start with 0. [i,2] matlab column 3 in the CSV
folder_name="list-wise-nonum"#keep the python script outside of the target folder (in this case the folder is called all)
8
+
Files= []
9
+
PathMain=folder_name
10
+
print(PathMain)
11
+
for (dirpath, dirnames, filenames) inos.walk(PathMain):
12
+
Files.extend(filenames)
13
+
print(Files)
14
+
15
+
forFileinFiles:
16
+
print(File)
17
+
WFile=open(PathMain+"\\"+File,'r',encoding='utf-8') #this removes target characters, 'utf-8' or 'latin-1', try to open files without encoding ",encoding='utf-8'" and rerun
18
+
line=WFile.read()
19
+
WFile.close()
20
+
#line_replaced = re.sub(r'\.+', ".", line) #two or more dots, reads line by line
21
+
#line_replaced = re.sub(r'\.\s+', ".", line_replaced) #empty space between two dots
0 commit comments