1.Get图片有三种方法
url = 'xx'
path = 'xx'
import requests
data = requests.get(url)
with open(path, 'wb+') as image:
image.write(data)
image.close()
import requests
data = requests.get(url, stream=True)
with open(path, 'wb+') as image:
for chunk in image.iter_content(chunk=512)
image.write(chunk)
image.close()
from urllib.request import urlretrieve
urlretrieve(url, path)
2.网页中的中文Unicode编码转换方式
UnicodeData.encode('utf-8').decode('unicode_escape')
3.对字符串的处理
String.replace('\\/', '/') #对左斜杠的处理最好转义,否则会得到一个DeprecationWarrning弃置警告
String.splite('str') #以str为分割切片字符串
String.index('str', index_seq) #以str为分割对字符串建立