随笔分类 - python
摘要:#! usr/bin/python #coding=utf-8 import urllib2 fp = open('test', 'wb') req = urllib2.urlopen('http://192.168.230.138/index.zip') for line in req: if not line: break fp.write(line) f...
阅读全文
摘要:GET 添加headers头import urllib2 request = urllib2.Request(uri) request.add_header('User-Agent', 'fake-client') response = urllib2.urlopen(request) POST 空数据import urllib2 request = urllib2.Request(u...
阅读全文
摘要:googlecode :https://code.google.com/archive/p/python-proxy/source/default/source # -*- coding: cp1252 -*- # # #Copyright (c) # #Permission is hereby granted, free of charge, to any person #obtain...
阅读全文
摘要:!/usr/bin/env python # encoding: utf-8 import urllib from pypinyin import pinyin, lazy_pinyin def toString(piny): if len(piny): print ''.join(lazy_pinyin(piny)) def getLis...
阅读全文
摘要:去空格及特殊符号s.strip().lstrip().rstrip(',')复制字符串#strcpy(sStr1,sStr2)sStr1 = 'strcpy'sStr2 = sStr1sStr1 = 'strcpy2'print sStr2连接字符串#strcat(sStr1,sStr2)sStr1...
阅读全文