Python String.find未返回任何值

Python String.find未返回任何值,python,string,Python,String,我正在尝试对以下值进行子串,以从中获取链接(图像值): <p>This is a recipe developed by my wife, Irene. It&rsquo;s been tweaked to perfection. I've never ordered congee in Manila since then.</p> <p style="text-align: center;"> (img src="http://img35.image

我正在尝试对以下值进行子串,以从中获取链接(图像值):

<p>This is a recipe developed by my wife, Irene. It&rsquo;s been tweaked to perfection. I've never ordered congee in Manila since then.</p>
<p style="text-align: center;">
(img src="http://img35.imageshack.us/img35/6047/69934653.jpg" alt="" >
</p>
str.find()
返回int,因此
Log('Position HTTP'+pos)
将引发
TypeError


改为<代码>日志(“位置http%s”%POS)

< P>也许您应该考虑使用正则表达式模块来代替:


您是否检查了
thumb
是否确实是您想要的字符串?
thumb = item.xpath('description')[0].text // To get the vaue from XML
            pos = thumb.find('http')   // Find http: and then Substring
            Log('Position HTTP'+pos)
            thumb = thumb[:pos]
            Log('Thumb Details'+thumb)
import re
match = re.search('http://\S+.(?:jpeg|jpg|png)', a_string)
print match.group(0)