Python post文件

import urllib2

opener = urllib2.build_opener()
rq = urllib2.Request(url='http://www.baidu.com',
        data=file_str,
        headers={'Content-Type': 'application/txt'})
rs = opener.open(rq).read()
print rs


Previous     Next
ponxu /
Categories Python  Tags Python