I'm unable to get list values to have int()
called upon them. The list is build from user input()
, a split()
and append()
. Code looks like:
coords = []
fcoords = input("Enter first coordinate pair:\n")
urlat, urlon = fcoords.split()
coords.append(urlat)
coords.append(urlon)
scoords = input("Enter second coordinate pair:\n")
lllat, lllon = scoords.split()
coords.append(lllat)
coords.append(lllon)
for coord in coords:
print (int(coord))
Gives me a ValueError: invalid literal for int() with base 10: '-122.4444'
.
I can switch the int(coord)
with float(coord)
but that's just extra work since I am converting decimal degree to dms. Using int()
gets the base without remainder which is what I want!
Is the split()
method not correct here, or are extra characters being hidden?