读取文档中内容,网站提交

来源:互联网 发布:python入门马哥教育 编辑:程序博客网 时间:2024/05/18 02:07
# -*- coding: cp936 -*-import urllibimport urllib2import timeurl = "http://xxx.xxx.xxx.xxx/cgi-bin/addaward"UUID = 'xxxxxx'with open('xxx.txt','r') as f:    lines = f.readlines()for line in lines:    if line=='\n': break    temp = line.strip('\n').split('\t')    uType = temp[0]    uSubType = temp[1]    uid = temp[2]    value = {        'AreaID':'1',            'Uid':UUID,          'Name':'',            'Type':uType,            'SubType':uSubType,            'ID':uid,            'Count':'1',    'Lock':'0'            }    data = urllib.urlencode(value)    req = urllib2.Request(url,data)    response = urllib2.urlopen(req)    time.sleep(1)ok=input('结束')

读取文件格式为:

6 2 7102xxx
6 2 7028xxx

0 0
原创粉丝点击