Re: using split for a string : error
Chris Angelico wrote:
> The other thing you may want to consider, if the values are supposed
> to be integers, is to convert them to Python integers before
> comparing. Currently, you're working with strings. Replace this:
> if sp == sp:
> with this:
> if int(sp) == int(sp):
I thought of this too and I wonder if there are any major differences
regarding performance compared to using the strip() method when parsing
In addition I guess one should catch the ValueError that might be raised
by the cast if there is something else than a number in the file.
|All times are GMT. The time now is 11:23 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.