def doRun(self): ret = self.makeMapFromExcel(self.xlsDbFile) self.strlines = self.makeSqlDropAndCreate(ret, self.createTableForm, self.fieldForm) neolib.StrToFile(self.strlines, "table/TABLE.SQL") self.strlines = self.makeSqlDropAndCreate(ret, self.dropTableForm, '') neolib.StrToFile(self.strlines, "table/DROP.SQL") None
def main(): list_lines = xlrd_util.get_lines_from_xls_by_index( '../rsc/neoserver_page_info.xlsx', 0) #neoutil.simple_view_list(list_lines) title_name = list_lines[0] content = [{title_name[idx]: col for idx, col in enumerate(line)} for line in list_lines[1:]] neoutil.StrToFile(neoutil.json_pretty(content), '../rsc/webinfo.json') #json.dump(content,open('../rsc/webinfo.json','w')) new_content = json.load(open('../rsc/webinfo.json', encoding='utf-8')) neoutil.simple_view_list(new_content)
def run(self): ret = requests.get(self.url) ret.encoding = 'utf-8' print(ret.content) neoutil.StrToFile(ret.text, "out/contents.out") with open("out/contents.org.html", "wb") as fo: fo.write(ret.content) self.parsing(ret.text) #img_src_patt = r'<img\s+src="([^"]+)"\s+alt="([^"]+)"\s*/' #print(self.mapTopid) return self
def run(self): for title, url, outfile, search, parser in self.list_tuples: # url = "https://www.naver.com" r = requests.get(url) neoutil.StrToFile(r.text, outfile) parse_name = parser(r.text) print(title) print(parse_name) self.list_result.append( (title, search, [(ord, title) for ord, title in parse_name])) #print(search.format(urllib.parse.quote(title))) return self
# subdict = ret.get(day_night,[]) # subdict.append(fmt_real_time.format(**tmp)) # ret[day_night] = subdict # print(ret['주간']) # print(ret['야간']) # if __name__ == '__main__': result = GetShowDailyInfo().run().get_html() for tmp in result: print(tmp) #neoutil.simple_view_list(result) #print(result) exit() neoutil.StrToFile(result, "out/out.html") exit() map_list = GetShowDailyInfo().run().get_contents() print([tmp['name'] for tmp in map_list['실시간'] if tmp['day_night'] == '야간']) print(map_list) real_time = map_list['실시간'] phone = map_list['전화'] status = map_list['출근현황'] for key, val in map_list.items(): print(key) for tmp in val: print(tmp)