通过python post提交数据的代码演示

2015-05-27 0 761
通过python post提交数据的代码演示
# -*- coding: cp936 -*-
 
import urllib2
import urllib
def postHttp(name=None,tel=None,address=None,
             price=None,num=None,paytype=None,
             posttype=None,other=None):
    url="http://www.xxx.com/dog.php"
    #定义要提交的数据
    postdata=dict(name=name,tel=tel,address=address,price=price,
                  num=num,paytype=paytype,posttype=posttype,other=other)
    #url编码
    postdata=urllib.urlencode(postdata)
 
    #enable cookie
 
    request = urllib2.Request(url,postdata)
    response=urllib2.urlopen(request)
    print response
 

遇见资源网 python 通过python post提交数据的代码演示 http://www.ox520.com/15369.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务