Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

Regular expression and strip html tag


<img alt="" src="lib/header1.jpg" style="padding : 1px;"/>       = dictionary  of attribute = {'alt': '', 'style': 'padding : 1px;', 'src': 'lib/header1.jpg'}

<a> fdsjfdsjf;lkjdsf </a>  =     <tag attribute1="xxxxx" attr2="yyyy">text</tag>        


code
    for x in soup.find_all('img') :
        print(x)
        print(x['src'])
        x['src'] = x.get('src').strip('lib/')
        print(x['src'])
        print(x.attrs)
Output
C:\Users\jkriker\Google Drive\FTUwebsite\O0O000OOO00O\migrate framed to unframed\cleaned

<img alt="" src="lib/header1.jpg" style="padding : 1px;"/>
lib/header1.jpg
header1.jpg
{'alt': '', 'style': 'padding : 1px;', 'src': 'header1.jpg'}

<img alt="" src="lib/NewItem460.png" style="padding : 1px;"/>
lib/NewItem460.png
NewItem460.png
{'alt': '', 'style': 'padding : 1px;', 'src': 'NewItem460.png'}


Regular expressions

for python




\/\/f.*uk\\

<ri.*\"\s\/>

<a.*\"\s/>













  • No labels