cut / change letters in a string in python
Hi, how do I cut all letters in a string? The string is "6.0b". Before using float ("6.0b") I'd like to change "b" to "02" or just cut all letters. Thanks and good night Marcus -- _____________________________________ (0> Marcus Schopen //\ P.O. Box 10 25 25 V_/_ 33525 Bielefeld, Germany ICQ#120991527 _____________________________________ Live as variously as possible
In Python country you can use: import re x = re.sub('[a-zA-Z]+','','6.0b') When you need the functionality in Zope use an External Method (or PythonScript ?!). ============================================================================ ==== Andreas Jung andreas@digicool.com Digital Creations "Zope Dealers" http://www.zope.org ----- Original Message ----- From: "Marcus Schopen" <marcus.schopen@uni-bielefeld.de> To: <zope@zope.org> Sent: Donnerstag, 12. Juli 2001 18:59 Subject: [Zope] cut / change letters in a string in python
Hi,
how do I cut all letters in a string? The string is "6.0b". Before using float ("6.0b") I'd like to change "b" to "02" or just cut all letters.
Thanks and good night Marcus
--
_____________________________________
(0> Marcus Schopen //\ P.O. Box 10 25 25 V_/_ 33525 Bielefeld, Germany
ICQ#120991527 _____________________________________
Live as variously as possible
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Marcus Schopen writes:
how do I cut all letters in a string? The string is "6.0b". Before using float ("6.0b") I'd like to change "b" to "02" or just cut all letters. Look at "string.translate", "string.replace" (--> Python library reference) and slicing (--> Python language reference).
Dieter
participants (3)
-
Andreas Jung -
Dieter Maurer -
Marcus Schopen