import requests
import time
class timeTaobao(object):
r1 = requests.get(url='
http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp',
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 UBrowser/6.2.4098.3 Safari/537.36'})
x = eval(r1.text)
timeNum = int(x['data']['t'])
def funcname():
timeStamp = float(timeTaobao.timeNum/1000)
timeArray = time.localtime(timeStamp)
otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
return otherStyleTime
t = timeTaobao.funcname()
print(t)
这段代码的类没有实例化,为啥能运行呢? 初学小白,见笑了
--
FROM 223.104.39.*