python 转php代码 60
importreimportbase64importurllib2importstructdefParseStock(url):fp=urllib2.urlopen(ur...
import re
import base64
import urllib2
import struct
def ParseStock(url):
fp = urllib2.urlopen(url, timeout=5)
content = fp.read()
patt = re.compile(r'\"(.*)\"')
m = patt.search(content)
start = m.start() + 1
end = m.end() - 1
while start < end:
min = (content[start:start+16])
start += 16
b = base64.b64decode(min)
avg = struct.unpack('<L', bytes(b[:4]))[0] / 1000.0
price = struct.unpack('<L', bytes(b[4:8]))[0] / 1000.0
amount = struct.unpack('<L', bytes(b[8:12]))[0]
print(avg, price, amount) 展开
import base64
import urllib2
import struct
def ParseStock(url):
fp = urllib2.urlopen(url, timeout=5)
content = fp.read()
patt = re.compile(r'\"(.*)\"')
m = patt.search(content)
start = m.start() + 1
end = m.end() - 1
while start < end:
min = (content[start:start+16])
start += 16
b = base64.b64decode(min)
avg = struct.unpack('<L', bytes(b[:4]))[0] / 1000.0
price = struct.unpack('<L', bytes(b[4:8]))[0] / 1000.0
amount = struct.unpack('<L', bytes(b[8:12]))[0]
print(avg, price, amount) 展开
展开全部
去泰国 做变性手术
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询