from urllib.parse import urlparse
res = urlparse('https://pixabay.com/get/52e5d1434c54aa14f6d1867dda6d367a103bdfe055586c4870287ed3904bc55cbd/norway-4540666_1920.jpg?attachment')
print(res.path)
res2=res.path.split('.')
print('.'+res2[-1])
如果本文对你有帮助,欢迎打赏本站

支付宝扫码打赏
微信扫码打赏
