I have a dictionary which may have long values for some key. I want to convert this dictionary to string and send it to a server. But when I am converting it to a string using str(dict) function for the values which have a long value is suffixed with 'L'. This when I am sending it to a server the value it is generating a problem. So can anyone suggest me a easier way of what I can do to avoid the 'L' suffix
I'm not sure what your use case is but to solve this problem and quite possibly the next problem you'll have I'd suggest using json.
import json
a = {'a': 10, 'b': 1234567812345678L}
print json.dumps(a)
# output:
{"a": 10, "b": 1234567812345678}
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