python笔记

POST修改添加请求头

import requests

url=””

r=requests.get(url)

kv={‘X-Forward-For’:”}

r=requests.post(url,headers=kv)

简单计算题

import re
import requests
url=”https://ctf.x10sec.org/web2/”
s=requests.session()
r=s.get(url)
res=re.search(‘<div name.*?>(.*?)</div>’,r.text,re.S)
usr=res.group(1)[:-3]
print(usr)
ans=eval(usr)
kv={‘pass_key’:’ans’}
r=s.post(‘https://ctf.x10sec.org/web2/?action=check_pass’,{‘pass_key’:ans})
print(r.text)

关于BeautifulSoup库

网上下载beautifulSoup包,解压放进libs里面,python输入 from bs4 import BeautifulSoup报错2to3 -w bs4,但是不知道为什么powershell不会报错,cmd进入lib目录,使用命令2to3 -w bs4,调用了tools里面的2to3.py,将bs4升级。(PS:我用过pip命令,说没找到适合python3.7的第三方包。)

字典类型

一些操作:

Leave a Reply

Your email address will not be published. Required fields are marked *