http://alexliyu.blog.163.com/blog/static/1627544962011101710824160/
#-*- coding:utf-8 -*-
import urllib2 import urllib import re,time import cookielib import hashlib import base64 import os import random text = 'sinaSSOController.preloginCallBack({"retcode":0,"servertime":1359647780,"pcid":"gz-77611738e3891e38ba8aaafe340459214841","nonce":"FCLUR1","exectime":1})' print('text = ' + text) try: #serverdata = re.findall('{"retcode":0,"servertime":(.+?),"nonce":"(.+?)"}',response.read(),re.I)[0] # serverdata = re.findall('{"retcode":0,"servertime":(.*?),"nonce":"(.*?)"}',re.I)[0] serverdata = re.findall('{"retcode":0,.*"nonce":"(.*?)".*}',text)[0] print serverdata[0] print serverdata[1] except: print("ffffff") 原文链接:https://www.f2er.com/regex/363206.html