On Jun 21, 4:00 pm, Stephen Hansen <me+list/pyt...@ixokai.io> wrote: > On 6/21/10 3:54 PM, davidgp wrote: > > > i basically tried this: > > lat =0.0 > > for line in f: > > lat = float(line) > > > but this gives an error.. does anyone know what i should to do? > > thanks, > > "An error"? > > Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) > [GCC 4.2.1 (Apple Inc. build 5646)] on darwin > Type "help", "copyright", "credits" or "license" for more information.>>> f = > open("test.txt", "r") > >>> for line in f: > > ... print float(line) > ... > 52.2375412 > 5.1802704 > > Always include what the actual error is that you're running into. > > -- > > Stephen Hansen > ... Also: Ixokai > ... Mail: me+list/python (AT) ixokai (DOT) io > ... Blog:http://meh.ixokai.io/ > > signature.asc > < 1KViewDownload
sorry :) invalid literal for long() with base 10: '51.9449702' this is the error i'm getting when i use long(line) and this is the error for float(line) invalid literal for float(): not found cheers, -- http://mail.python.org/mailman/listinfo/python-list