python - "Float" object not subscriptable -
i have looked over, , have not found answer.
what trying create list of every longitude 71.42 w 70.87 w, , every latitude 42.19 n 42.54 n every 1/100th of latitude/longitude.
so, kind of like:
(42.19, -71.42) (42.19, -71.43) (42.19, -71.44)...
(42.20, -71.42) (42.20, -71.43)etc.,
my code looks far:
latlong = [(42.19, -71.42)] while latlong[-1][0] < 42.54: latlong.append(latlong[-1][0] + 1) print(latlong) the problem when try code, (which supposed longitude,) typeerror: 'float' object not subscriptable.
any appreciated.
thanks!
edit: answered! thanks, corycramer
if understand shooting for, want grid bounded latitudes , longitudes? like
import itertools longs = [-i / 100.0 in range(7087, 7142)] lats = [i / 100.0 in range(4219, 4254)] latlong = list(itertools.product(lats, longs)) output
[(42.19, -70.87), (42.19, -70.88), (42.19, -70.89), ... ... (42.28, -70.87), (42.28, -70.88), (42.28, -70.89), ... ... ... (42.53, -71.39), (42.53, -71.4), (42.53, -71.41)]
Comments
Post a Comment