['2009-08-31 23:59:35 ', 'RT @brahmresnik: Pastor v Obama: Leading national tracker of hate groups taking close look at Tempe pastor on 12 News at 5. #NOH8\n']
with open('newdata.txt') as f: for line in f: tweet=re.sub(r'T\t',"",line) t=re.sub(r'W\t',"\/\/",tweet) data=t.split("\/\/") print(data) d = [{'Date': x[0], 'Tweet': x[1]} for x in data] print(d)
[{'Date': '2', 'Tweet': '0'}, {'Date': 'b', 'Tweet': 'a'}]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)