translate tables versus replace
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Thu Oct 31 23:38:50 EST 2002
More information about the Python-list mailing list
Thu Oct 31 23:38:50 EST 2002
- Previous message (by thread): translate tables versus replace
- Next message (by thread): What the heck has happened to PythonWin???
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
David Bear <david.bear at asu.edu> wrote previously: |But then I thought perhaps a translate table would work. A translate table |that would convert the badchars into a space might work. I was hoping |there was an easier way. However my biggest concern is performance of |successive calls to replace versus a call to translate. Which might be |'faster'...? Gee... why not TEST it using the time.clock() facility. It looks like all of about 10 lines of code are needed to compare the two techniques (far fewer lines than in the post asking the question). Yours, Lulu... P.S. After you're done testing, you'll find that string.translate probably runs 100x faster. But you'll feel better if you test it yourself. -- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.
- Previous message (by thread): translate tables versus replace
- Next message (by thread): What the heck has happened to PythonWin???
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list