@@ -98,24 +98,22 @@ def main():
9898        print ("." , end = " " )
9999
100100        #preserves original html file with a .old extension 
101-         #  os.rename(filepath, filepath+'.old')
101+         os .rename (filepath , filepath + '.old' )
102102
103-         # print(".", end=" ") 
104- 
105- 
106-         # #exports file with as HTML and TXT 
107-         # with open(filepath, 'w', encoding="utf-8") as file: 
108-         #     file.write(str(soup)) 
109-         # with open(os.path.join(folderpath, KBID)+'.txt', 'w', encoding="utf-8") as file: 
110-         #     file.write(str(soup)) 
103+         print ("." , end = " " )
111104
105+         #exports file with as HTML and TXT 
106+         with  open (filepath , 'w' , encoding = "utf-8" ) as  file :
107+             file .write (str (soup ))
108+         with  open (os .path .join (folderpath , KBID )+ '.txt' , 'w' , encoding = "utf-8" ) as  file :
109+             file .write (str (soup ))
112110
113-         #  print(".", end=" ")
111+         print ("." , end = " " )
114112
115-         #  file_replace_text(filepath, '<p><br/></p>', '')
116-         #  file_replace_text(filepath, '<body>', '<body>\n<div>')
117-         #  file_replace_text(filepath, '</body>', '</div>\n</body>')
118-         #  file_replace_text(filepath, '', '=>')
113+         file_replace_text (filepath , '<p><br/></p>' , '' )
114+         file_replace_text (filepath , '<body>' , '<body>\n <div>' )
115+         file_replace_text (filepath , '</body>' , '</div>\n </body>' )
116+         file_replace_text (filepath , '' , '=>' )
119117
120118        print ('done!' , end = " " )
121119        sys .stdout .flush ()
0 commit comments