代码拉取完成,页面将自动刷新
# -*-coding=utf-8-*-
__author__ = 'Rocky'
'''
http://30daydo.com
Email: weigesysu@qq.com
'''
import re
from setting import get_mysql_conn
# 是否黑名单
def check_blacklist(code):
conn = get_mysql_conn('db_stock')
cur = conn.cursor()
cmd = 'select * from tb_blacklist where code=\'{}\''.format(code)
cur.execute(cmd)
ret = cur.fetchone()
if len(ret)==0:
return False
else:
print(ret[3])
return True
# 是否是东北的
def dongbei(code):
dongbei_area = ['黑龙江','吉林','辽宁']
conn = get_mysql_conn('db_stock')
cur = conn.cursor()
cmd = 'select area from tb_basic_info where code=\'{}\''.format(code)
cur.execute(cmd)
ret = cur.fetchone()
if ret[0] in dongbei_area:
return True
else:
return False
def get_code(name):
conn = get_mysql_conn('db_stock')
cur = conn.cursor()
cmd = 'select code from tb_basic_info where name=\'{}\''.format(name)
cur.execute(cmd)
ret = cur.fetchone()
return ret[0]
def diagnose(code):
if check_blacklist(code):
print('存在黑名单')
if dongbei(code):
print('东北股')
def main():
ipt = raw_input('输入诊断个股的代码或者名称: ')
if not re.search('\d{6}',ipt):
code = get_code(ipt)
print(code)
diagnose(code)
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。