A question about string and float number

Edwin.Madari at VerizonWireless.com Edwin.Madari at VerizonWireless.com
Wed Aug 6 22:21:38 EDT 2008


type(s) == type(float())

-----Original Message-----
From: python-list-bounces+edwin.madari=verizonwireless.com at python.org [mailto:python-list-bounces+edwin.madari=verizonwireless.com at python.org]On Behalf Of Wei Guo
Sent: Wednesday, August 06, 2008 9:23 PM
To: python-list at python.org
Subject: A question about string and float number


Hi all,
 
I am new of python. Could anyone help me a question as below?
 
Is there any function that can judge a string s is a float number or not? FOr example, if s = '1.232' or s='1e+10', then it returns true, otherwise, it will return false.
 
isdigit() in string doesn't work. float() will throw an exception and I just need true or false as result.
 
Thanks a lot in advance,
 
Wei



The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080806/3d13ec8b/attachment-0001.html>


More information about the Python-list mailing list