unix时间转换

import time
import datetime
unixtime = int(time.mktime(datetime.datetime.now().timetuple()))    #获取当前unix时间
readable_time = datetime.datetime.fromtimestamp(unixtime)           #unix时间转换成正常日期

13位unix时间

import time
current_milli_time = lambda: int(round(time.time() * 1000))

python读取大文件

with open(filename, 'rb') as f:
  for line in f:
    <do something with the line>

python html解码

import html
a="&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;"
html.unescape(a)
#'javascript:alert(1)'