Thread: store Python output information in Mongodb database
hello developers, have written code walks through html files in directory , fetches event , date information , print on screen. want data stored in database. have installed mongodb , pymongo module. how can insert output data database. code: import re import os bs4 import beautifulsoup subdir, dirs, files in os.walk("/home/himanshu/event/"): fle in files: path = os.path.join(subdir, fle) soup = beautifulsoup(open(path)) #print event title print (soup.h1.string) #date , time detection s=soup.get_text() pat=r'\d{1,2} - \d{1,2} \w{3} \d{4}' m=re.search(pat,s) if m none: pat1=r'\d{1,2} \w{3} \d{4}' m1=re.search(pat1,s) if m1 none: pat2=r'\d{1,2} \w{3} - \d{1,2} \w{3} \d{4}' m2=re.search(pat2,s) if m...