> i have an html/cgi input that takes in values to a mysql
> database, however, if i stick in $20 instead of 20, it
> crashes the program because of the extra $ sign. I was
> wondering if anyone has a quick regular expression in
> python to remove the $-sign if it is present in the
> input.
While
[EMAIL PROTECTED] wrote:
> Fredrik Lundh>RE? ex-perler? try strip+lstrip instead:<
>
> Or even:
> >>> text = " $12921 "
> >>> text.replace("$", "")
> ' 12921 '
That's fair enough with the given input, but it would silently swallow
the "$" in "123$5678" -- this sort of approach leads to al
Fredrik Lundh>RE? ex-perler? try strip+lstrip instead:<
Or even:
>>> text = " $12921 "
>>> text.replace("$", "")
' 12921 '
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
"Kun" <[EMAIL PROTECTED]> wrote:
> i have an html/cgi input that takes in values to a mysql database,
> however, if i stick in $20 instead of 20, it crashes the program
> because of the extra $ sign. I was wondering if anyone has a quick
> regular expression in python to remove the $-sign if it i
i have an html/cgi input that takes in values to a mysql database,
however, if i stick in $20 instead of 20, it crashes the program because
of the extra $ sign. I was wondering if anyone has a quick regular
expression in python to remove the $-sign if it is present in the input.
--
http://mail