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