Whats the best way to convert int's, long's, double's to strings and vice versa in python.
I am looping through a list and passing longs to a dict that should be turned into a unicode string.
I do
for n in l:
{'my_key':n[0],'my_other_key':n[1]}
Why are some of the most obvious things so complicated?
To convert from a numeric type to a string:
str(100)
To convert from a string to an int:
int("100")
To convert from a string to a float:
float("100")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With