Deleting certain characters in text

1 view
Skip to first unread message

astrodad

unread,
Feb 3, 2012, 10:17:38 AM2/3/12
to beautifulsoup
Hi folks.

After doing various other cleanup and extracts from some really bad
HTML, I am left with the following:

'); //-->

I tried using:

' Fix the leftover garbage from the poorly contructed JS'
garbagelines = cleanedup.findAll(text="'); //-->")
[garbage.extract() for garbage in garbagelines]

It doesn't seem to find anything. I'm sure it's something simple
related to those special characters, but I haven't figured it out. Can
you please help?





Bruce Eckel

unread,
Feb 8, 2012, 4:42:20 PM2/8/12
to beauti...@googlegroups.com
1) print cleanedup to a file before you do the fix, so you can look for random whitespace characters or other stuff.

2) Just for the heck of it, try a regular expression in your find.

-- Bruce Eckel
www.Reinventing-Business.com
www.MindviewInc.com








--
You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
To post to this group, send email to beauti...@googlegroups.com.
To unsubscribe from this group, send email to beautifulsou...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beautifulsoup?hl=en.


Reply all
Reply to author
Forward
0 new messages