[Tutor] Text manipulation problem
lumbricus@gmx.net
lumbricus@gmx.net
Wed Nov 27 16:31:46 2002
Hi!
[ snip ]
> #egregiously erroneous pseudo-code alert
> import sys, string, os, os.path, glob, re #all the stuff to do the
> manipulation
>
> def gettextpopup():
> """Find JavaScript text pop-ups in HTML and convert to table."""
>
> prompt=raw_input("Go to where I want")
> prompt.chdir #now where i want to be
try:
os.chdir(prompt)
except OSError:
do_something()
> prompt2=raw_input("what files do i want")
> glob the files...
>
> prompt3=raw_input("do I want to start converting? y/n")
> if prompt3=='y':
if raw_input("do You wanna start? (y/n)").strip().lower() in [ 'y', 'yes' ]:
:-)
> re.compile (insert reg expr here) #whatever it will be
> re.findall
> elif prompt3='n': print "Thanks for dropping by."
same principle applies.
> So compiling the re object is ok (sort of) for me...
Correct parsing of html with re's is impossible.
> What I need to do is take the previously listed html, and convert it into
> the table mess... keeping the different text sandwiched between the tags
> integral.
import htmllib, HTMLParser
[ snip ]
Just my 0.02 EUR
HTH, J"o!
--
sigfault
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!