#使用正规表达法
import re
news='http://news.sina.com.cn/w/2018-04-06/doc-ifyuwqez5561427.shtml'
#获取doc-i与.shtml中间的数据
m=re.search('doc-i(.*).shtml',news)
#group(0)为与标识符的整个字符,(1)仅为该目标数据
print(m.group(0))
print(m.group(1))
#对字符模板的填补
a='http://news.sina.com.cn/w/2018-04-06/doc-i{}.shtml'
b='fyuwqez5561427'
a.format(b)