私はhtmlファイルを扱っています。最初の項目 2 の前と項目 1a の後にあるテキストを抽出したい (助けてくれてありがとう)。最初に、2 番目の項目 2 の後に続くテキストを削除します。
text= """"""<this is an example this is Item 2. A href="#106">Item 1a. thanks for helping <B>Item 2. Properties</B> this is an example this is Item 2.stachoverflow"""
>>> a=re.search ('(?<=<B>)Item 2\.',text)
>>> b = a.span()
>>> newText= text[:b[1]]
>>> c=newText.rfind("1a")
>>> (newText[c[1]:])
TypeError: 'int' object is not subscriptable
c の後に来るテキストを印刷するにはどうすればよいですか?