Jul-24-2018, 03:52 PM
(This post was last modified: Jul-24-2018, 03:53 PM by Complex_Potential.)
Thanks both
snippsat - that worked like a charm, thank you. I'll have to check out chardet. It looks very handy for figuring out encoding.
Ok, next question (sorry!)
I've tried to put this data into a list so I can work with it but it looks different in list format to printed format:
What am I doing wrong?
snippsat - that worked like a charm, thank you. I'll have to check out chardet. It looks very handy for figuring out encoding.
Ok, next question (sorry!)
I've tried to put this data into a list so I can work with it but it looks different in list format to printed format:
datapoints = [] with open("C:\\...\\170825 t05 L11O44S3.txt", encoding ='UTF-16') as f: for i in f: datapoints.append(i) print(datapoints)
Output:['25 August 2017 09:15:00\t23.19\n', '25 August 2017 09:00:00\t22.98\n', '25 August 2017 08:45:00\t22.76\n', '25 August 2017 08:30:00\t22.62\n, ....'
So I tried removing the \, t and n in the list by modifying the code to datapoints = [] with open("C:\\...\\170825 t05 L11O44S3.txt", encoding ='UTF-16') as f: for i in f: datapoints.append(i) for data in datapoints: data = data.replace('\\t',' ') data = data.replace('\\n','') print(datapoints)but this results in exactly the same output as before.
What am I doing wrong?