Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73447
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'else:': 0.03; 'beginner': 0.05; 'float': 0.07; 'string': 0.09; 'converted': 0.09; 'try:': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'def': 0.12; 'simplest': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'saying': 0.22; 'guys': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'raise': 0.29; 'converting': 0.30; 'message-id:@mail.gmail.com': 0.30; 'stuff': 0.32; "we're": 0.32; 'fri,': 0.33; 'except': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'catch': 0.60; 'most': 0.60; 'determine': 0.67; 'dont': 0.67; '20,': 0.68; 'fails,': 0.84; 'subject:check': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=kstYoAO9/jGgr5LAWt3S7QeVvkr4oOJQSDfFImz8SbQ=; b=KuPSgr5HuZ3ca1P9IQ2ZvlEARjlZHnYzV77b48IgnV3i/hDetuwpZIA+FdPYJ9YoKF ZA/nqZ8FGQyFdsE+z8mZFd2FGQTTTRCuU+1AcaxTUiwpzFonkbWehKCd4gCkBygkyZEG gzRL7c2TMRxaxkEWyMM3+gja295eGOVD3leK+SQBjqhIy19fPd7IxWfVk/itF5VhKH/m nkWeXpbmK7CQhLAN5//fipH906mVEXmUIkPMytvLOAYRU0tjMnR2OTb95FEc/F1Y6R0+ Cw9VoIPpdvZpimqX/lEpMPWd+w53fPKOBM64Jixe0omT5erVisqnhZ08NydW1DMd8G+S HeGw== |
| X-Received | by 10.236.229.133 with SMTP id h5mr2006720yhq.64.1403245408751; Thu, 19 Jun 2014 23:23:28 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <c21b1d32-a716-4629-aad6-357b62a8f529@googlegroups.com> |
| References | <d5ca21d7-23e6-4240-83d8-262d0f877f7e@googlegroups.com> <c21b1d32-a716-4629-aad6-357b62a8f529@googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Fri, 20 Jun 2014 00:22:47 -0600 |
| Subject | Re: how to check if a value is a floating point or not |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11161.1403245837.18130.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1403245837 news.xs4all.nl 2966 [2001:888:2000:d::a6]:43346 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:73447 |
Show key headers only | View raw
On Fri, Jun 20, 2014 at 12:14 AM, Nicholas Cannon
<nicholascannon1@gmail.com> wrote:
> Guys i am only a beginner at python most of the stuff you are saying i need to do i dont understand.
All we're saying is that the simplest and most accurate way to
determine whether a string can be converted to an int or a float is to
try converting it and see if it succeeds. If it fails, it will raise
an exception that you can catch using the try-except syntax. Here's
what your checkint function might look like:
def checkint(a):
try:
int(a)
except ValueError:
return False
else:
return True
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to check if a value is a floating point or not nicholascannon1@gmail.com - 2014-06-18 22:53 -0700
Re: how to check if a value is a floating point or not Gary Herron <gary.herron@islandtraining.com> - 2014-06-18 23:22 -0700
Re: how to check if a value is a floating point or not Nicholas Cannon <nicholascannon1@gmail.com> - 2014-06-18 23:48 -0700
Re: how to check if a value is a floating point or not Ben Finney <ben@benfinney.id.au> - 2014-06-19 17:19 +1000
Re: how to check if a value is a floating point or not Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 01:23 -0600
Re: how to check if a value is a floating point or not Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-19 01:37 -0600
Re: how to check if a value is a floating point or not Sturla Molden <sturla.molden@gmail.com> - 2014-06-19 13:46 +0000
Re: how to check if a value is a floating point or not Nicholas Cannon <nicholascannon1@gmail.com> - 2014-06-19 23:14 -0700
Re: how to check if a value is a floating point or not Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-20 00:22 -0600
Re: how to check if a value is a floating point or not Sturla Molden <sturla.molden@gmail.com> - 2014-06-20 13:16 +0000
Re: how to check if a value is a floating point or not Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-20 14:40 +0100
Re: how to check if a value is a floating point or not Grant Edwards <invalid@invalid.invalid> - 2014-06-20 14:28 +0000
Re: how to check if a value is a floating point or not alister <alister.nospam.ware@ntlworld.com> - 2014-06-20 15:15 +0000
Re: how to check if a value is a floating point or not Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-20 09:44 -0600
csiph-web