Terry Reedy <[email protected]> writes: > On 10/14/2011 9:05 PM, Chris Angelico wrote:
> > That tests if the object is already an int; the OP asked if a string > > contains an integer. > > The misleading subject line did not. It should have been "How to test > if a string contains an integer?" Which would still be misleading :-) Even better is “How to test whether a string is a valid representation of an integer?” I say that's better because it gets to the relevant point of asking *which* representations you want to test for – what qualifies as valid for your particular use case, and what does not. There's no single right answer; the programmer must choose exactly what they want to test for. -- \ “When I was a little kid we had a sand box. It was a quicksand | `\ box. I was an only child... eventually.” —Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
