Eat this one

Rikard Bosnjakovic bos at hack.org
Tue Mar 27 10:35:37 EST 2001


I feel ashamed to show the code, but I didn't find any other solution :)

txt = list(cgi.escape(open("somefile").read()))
for i in range(len(txt)):
    try:
        txt.remove(" ")
    except:
        try:
            txt.remove("\n")
        except:
            try:
                txt.remove("<")
            except:
                try:
                    txt.remove(">")
                except:
                    try:
                        txt.remove("&")
                    except:
                        pass
                    pass
                pass
            pass
        pass



What way would be better and _faster_ to wipe out the five chars from
the list?

-- 
Rikard Bosnjakovic - http://a214.ryd.student.liu.se/cv/ - ICQ: 1158217

Anyone sending unwanted advertising e-mail to my address will be
charged $250 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.



More information about the Python-list mailing list