mysql数据库自增去重!
2019-01-07 本文已影响0人
朝畫夕拾
db= pymysql.connect('localhost','root','root','document',charset="utf8")
cursor= db.cursor()
sql= '''select pic FROM TongCheng_58;'''
cursor.execute(sql)
detail_list= cursor.fetchall()
one_typle= detail_list[5]
print(one_typle)
pic= 'pic2.58cdn.com.cn/mobile/small/n_v2b7d864642c6240f19278d1b4837520a1.jpg?w=294&h=220&crop=2'
#pic_tuple= tuple(pic)
pic_tuple= (pic,),
lll= set(pic_tuple).issubset(set(detail_list))
if lll!= True:
print("没在数据库里!")
print("*" * 100)
else:
print("已经在数据库里")
print("-" * 100)