Nov-22-2019, 01:12 PM
Hi,
I'm getting some strange characters at the beginning of an string that I am setting up for a request payload.
In this example I am trying to read a text file containing one data item and then enumerate it.
{"1": "\u00ef\u00bb\u00bf10841911101489"}
the return should read :
{"1": "10841911101489"}
Can anyone help please?
Many thanks,
Fiorano
I'm getting some strange characters at the beginning of an string that I am setting up for a request payload.
In this example I am trying to read a text file containing one data item and then enumerate it.
with open('list.txt', 'r') as f:
d = {k: v.strip() for (k, v) in enumerate(f, start=1)}
data = json.dumps(d)
with open('out.txt', 'w') as f_out:
f_out.write(data)the resulting out.txt contains{"1": "\u00ef\u00bb\u00bf10841911101489"}
the return should read :
{"1": "10841911101489"}
Can anyone help please?
Many thanks,
Fiorano
