python异常处理

2020-01-13 11:15:26 浏览数 (1)

代码语言:javascript复制
import re,random,traceback
kk ='<img src="//kanimg.9ku.com/Article/20170727/1501135687683763.gif" alt="不要惹怒胖子,后果自己看">'

p =re.findall(r"src="//(.*?)" alt="",  kk)
kk1 =''
try:
    kk1 = p  '323'
except Exception as e:
    traceback.print_exc()
    print(e)
print(kk1)

traceback.print_exc() 打印出出错的代码在哪一行。

更多 参考: https://www.cnblogs.com/shangpolu/p/7206348.html

0 人点赞