I was trying to do some data mining with twitter and ran into this problem. Python keeps converting the tweet's large numerical id's to scientific notation when I try to write it to a CSV file. For example, if the ID was 9381435503399854 python will convert it to 9.381435503399854E+17. I tried using format(int(tweet.id), ".0f") but it is giving me the same result. Format(int(tweet.id), "f") seems like it works but appends ".000000" to the end of the id. Any suggestions would be greatly appreciated. Here is some sample code:
writeExtended(count, tweet.id, tweet.full_text.encode('utf8'), tweet.display_text_range, tweet.created_at)
def writeExtended(id, idstr, full_text, display_text_range, created_at):
#Write Extended tweet details to CSV file
with open('Extended.csv', mode='a+') as employee_file:
employee_writer = csv.writer(employee_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
employee_writer.writerow([id,idstr, full_text, display_text_range, created_at])
