I’m reading into a csv file an extracting a piece of data with the line:
x = float(node[1])
when I print(x), I get the correct value or the exact value found in the cell. e.g 153.018848
But when I try to pass x as variable in the following:
print('<node version="0" lon="%d">' %(x))
the output will be <node version="0" lon="153"> . Of course I want the value 153.018848.
What have I overlooked?
Thanks in advance.
You’ve overlooked the fact that
%dis for integers. Try%finstead.