Ich versuche, in eine HTML-Datei übereinstimmen. Dies ist der html:Python regulären Ausdruck übereinstimmen in HTML-Datei
<td>
<b>BBcode</b><br />
<textarea onclick='this.select();' style='width:300px; height:200px;' />
[URL=http://someimage.com/LwraZS1] [IMG]http://t1.someimage.com/LwraZS1.jpg[/IMG][ [/URL] [URL=http://someimage.com/CDnuiST] [IMG]http://t1.someimage.com/CDnuiST.jpg[/IMG] [/URL] [URL=http://someimage.com/Y0oZKPb][IMG]http://t1.someimage.com/Y0oZKPb.jpg[/IMG][/URL] [URL=http://someimage.com/W2RMAOR][IMG]http://t1.someimage.com/W2RMAOR.jpg[/IMG][/URL] [URL=http://someimage.com/5e5AYUz][IMG]http://t1.someimage.com/5e5AYUz.jpg[/IMG][/URL] [URL=http://someimage.com/EWDQErN][IMG]http://t1.someimage.com/EWDQErN.jpg[/IMG][/URL]
</textarea>
</td>
Ich möchte alle BB-Code von [zu] enthalten enthalten.
Und dies ist mein Code:
import re
x = open('/xxx/xxx/file.html', 'r').read
y = re.compile(r"""<td> <b>BBcode</b><br /><textarea onclick='this.select();' style='width:300px; height:200px;' />. (. *) </textarea> </td>""")
z = y.search(str(x())
print z
Aber wenn ich das i Objekt erhalten Keine laufen ... Wo ist der Fehler?
vergessen paren 'read()'. –
Nichts, immer noch eine None .. Vielleicht ist die Regex falsch .. –
Yeah, gepostet eine answer.check. –