This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# -*- coding: utf-8 -*-
importmiddlewares
importtime
importsettings
defshowBanner(menu='main'):
print(settings.BANNER.get(menu),end='')
defswitch(menu='1'):
case={
'1':main,
'2':introduce,
'3':view,
'4':middlewares.save2Redis,
'5':middlewares.clearRedis,
'6':milkSpider,
'7':aexit
}
ifmenuincase.keys():
case.get(menu)()
else:
print("no such choice",end='')
return
defmain():
whileTrue:
showBanner()
menu=str(input("选择一项:"))
switch(menu)
defintroduce():
print(settings.BANNER.get('introduce'),end='')
whileTrue:
select=str(input())
ifselect=="r":
return
else:
print("invaild choice!")
defview():
print("this is view()")
return
defmilkSpider():
print("注意:调用milkSpider将启动selenium以及requests进程,因为爬取数据量较大,\n往往会占用较多时间,确定吗?[c]continue or [q]quit:",end='')