python中简单的常用语句
# coding=utf-8
import os
import random
import time
import keyboard
'''解决乱码错误'''
# response.encoding = response.apparent_encoding
#
'''写入语句'''
# with open('D:\py\spider\py\sssp\%s' % path1, 'ab') as f:
# f.write(img.content)
'''列表遍历序号'''
# wow = ['http://img1.ph.126.net/R2_gSkRA4zNELhXuX9_OEw==/6630329993398475284.jpg', 'http://cms-bucket.nosdn.127.net/catchpic/8/82/8296a910b98f81b9b7bf841cfd67edf2.jpg?imageView&thumbnail=550x0', 'http://p2.qhimgs4.com/t01f7fa9ef12a474a2b.jpg', 'http://b-ssl.duitang.com/uploads/item/201512/26/20151226171329_mML8H.jpeg', 'http://p3.ifengimg.com/a/2017_04/f367479bacd6464_size949_w2048_h2048.jpg', 'http://hbimg.b0.upaiyun.com/d19d47c6e6b14499ce342d4424eb55b66be78d2428da4-C8ENkk_fw658', 'http://p3.pstatp.com/large/1069000225b0e9957e83', 'http://s7.sinaimg.cn/mw690/001LrWZCzy7aycIwj30c6&690', 'http://n.sinaimg.cn/sinacn23/300/w950h950/20180823/652d-hicsiav8906290.jpg', 'http://n.sinaimg.cn/front/420/w808h1212/20180328/QrmW-fysqfnh7144441.jpg', 'http://s1.sinaimg.cn/mw690/006X4vlhzy7eBHWv4tyc0&690', 'http://n1.itc.cn/img8/wb/recom/2017/03/02/148843918756852542.JPEG', 'http://img31.mtime.cn/pi/2014/07/24/152831.87354953_1000X1000.jpg', 'http://www.sinaimg.cn/dy/slidenews/4_img/2012_37/703_746250_339937.jpg', 'http://p2.cri.cn/M00/C5/52/CqgNOljq7kaAfspTAAAAAAAAAAA063.686x428.jpg', 'http://b-ssl.duitang.com/uploads/item/201612/16/20161216162859_xH4JC.jpeg', 'http://img1.gtimg.com/hn/pics/hv1/21/45/1194/77651346.jpg', 'http://img5.cache.netease.com/photo/0003/2014-12-31/AEQAFIRI00AJ0003.jpg', 'http://img1.ph.126.net/sGag4XVi2Q9IdmOS6njqRg==/6632065022748326038.jpg', 'http://img2.ph.126.net/qdBm2na-CtCBzpolEgRxyQ==/2133298848507067742.jpg', 'http://img2.ph.126.net/2I8L0rr1w0fbci29iSeO_w==/6631842921397404833.jpg', 'http://img1.ph.126.net/2KxlIAlHIC0RNHPdNBMjNQ==/867505878322563490.jpeg', 'http://hbimg.b0.upaiyun.com/0bc2c9acb8dfda867d34bb310c50ba0c20a0c287dd86-ZQfkhX_fw658', 'http://b-ssl.duitang.com/uploads/item/201801/19/20180119072554_fpope.jpg', 'http://pic.ffpic.com/files/2015/0313/0312qzmnjtxziphonebz6.jpg']
# k = 0
# for i in wow :
# k = k + 1
# print(i, k)
'''随机睡眠'''
# mom = 'uyiujbkjbkihkihbk'
# for i in mom:
# time.sleep(random.randint(3, 6))
# print(i)
# print(time.time())
'''随机输出'''
# k = random.randint(0, 5)
# print(k)
# wild = ['wild_boar', 'wild_dog', 'birdie', 'tiger', 'mouse', 'dragon']
# print('遇到', wild[k])
'''遍历文件列表'''
# images = os.listdir('F:\one_face')#对比图片的图片列表
# for image in images:
# print(image)
'''等待键盘输入后执行'''
# keyboard.wait(hotkey='k')
# print(123)
# keyboard.wait(hotkey='p')
# print(321)