下面是split截取获得
>>> 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
>>>
下面是通过切片获得的
name = str[str.rfind(“/”)+1:str.rfind(“.”)]
与上面的结果是一样的.
如果找到其他方法 ,会继续补充的