Raul2018

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

From: https://blog.csdn.net/q1059081877q/article/details/50687683

 

>>> str = 'http://manualfile.s3.amazonaws.com/pdf/gti-chis-1-user-9fb-0-7a05a56f0b91.pdf'
>>> print str.split()
['http://manualfile.s3.amazonaws.com/pdf/gti-chis-1-user-9fb-0-7a05a56f0b91.pdf']
>>> print str.split('/')
['http:', '', 'manualfile.s3.amazonaws.com', 'pdf', 'gti-chis-1-user-9fb-0-7a05a56f0b91.pdf']
>>> print str.split('/')[-1]
gti-chis-1-user-9fb-0-7a05a56f0b91.pdf
>>> print str.split('/')[-1].split('.')[0]
gti-chis-1-user-9fb-0-7a05a56f0b91

posted on 2018-12-05 16:15  Raul2018  阅读(638)  评论(0编辑  收藏  举报