I have been mining tweets. The main problem I have been facing is - I have to encode the tweets to UTF-8 and then write them to a file.
My current method:
def on_data(self,data):
f=open('new','w')
dict1=json.loads(data)
val=dict1["text"]
val= codecs.encode(val,"utf-8","ignore")
var.x+=1
f.write(str(var.x)+"\t"+val+"\n")
return True
Any way to speed up this process?