def getVercode(teleNum): time.sleep(5) #在xnmsg数据库中查询对应手机号的短信内容 content=Db("xnmsg").sql("SELECT content FROM sms_sendlog_his WHERE mobile="+teleNum+" ORDER BY id DESC LIMIT 1 ") #将短信中的验证码过滤出来,抽取字符串中的数字用filter(str.isdigit, item) code_zc=filter(str.isdigit,content.encode('UTF-8')) return code_zc print code_zc
def getVercode(self,teleNum): time.sleep(5) content=Db("xnmsg").sql("SELECT content FROM sms_sendlog_his WHERE mobile="+teleNum+" ORDER BY id DESC LIMIT 1 ") code_zc=filter(str.isdigit,content.encode('UTF-8')) return code_zc print code_zc