python3版,模仿楼上的写法。
不用curl
用pip install requests 安装requests。- # -*- coding: utf-8 -*-
- """
- Created on 2017-05-22 21:38:48
-
- @author: codegay
- """
- import requests
-
- txt1 = [r.rstrip() for r in open("1.txt").read()]
- txt2 = [r.rstrip() for r in open("2.txt").read()]
- txt3 = [r.rstrip() for r in open("3.txt").read()]
- txt4 = [r.rstrip() for r in open("4.txt").read()]
-
-
- url = 'http://bathome.net'
-
- data = zip(txt1,txt2,txt3,txt4)
- session = requests.sessions()
-
- for t1,t2,t3,t4 in zip(txt1,txt2,txt3,txt4):
- data = {1:t1,2:t2,3:t3,4:t4}
- session.post(url,data=data)
复制代码
|