如何避免python将大数字转换为科学符号?
我的数据结构如下:如何避免python将大数字转换为科学符号?,python,csv,Python,Csv,我的数据结构如下: ['1404407396000', '484745869385011200', '0', '1922149633', "The nurse from the university said I couldn't go if I don't get another measles immunization...", '-117.14384195', '32.8110777'] 我想将这些数据写入csv文件,但当我这样做时,python会将数字转换为科学符号(例如1
['1404407396000',
'484745869385011200',
'0',
'1922149633',
"The nurse from the university said I couldn't go if I don't get another measles immunization...",
'-117.14384195',
'32.8110777']
我想将这些数据写入csv文件,但当我这样做时,python会将数字转换为科学符号(例如1.404E12)
我正在使用以下功能将列表列表转换为csv:
def list_to_csv(data,name_of_csv_string):
import csv
"""
This function takes the list of lists created from the twitter data and
writes it to a csv.
data - List of lists
name_of_csv_string - What do you think this could be?
"""
with open(name_of_csv_string + ".csv", "wb") as f:
writer=csv.writer(f)
writer.writerows(data)
如何避免这种情况?使用此处描述的格式规范迷你语言:
搜索:7.1.3.1。格式规范迷你语言使用此处描述的格式规范迷你语言: 搜索:7.1.3.1。格式规范迷你语言使用字符串格式
writer.writerows("%f" % data)
您可以签出各种格式选项。使用字符串格式
writer.writerows("%f" % data)
您可以查看各种格式选项。请提供一个完整的可运行示例。目前还不清楚数据与
list\u to\u csv
函数的关系,也不清楚是什么让您认为Python将数字转换为科学符号。从中可以看出,Python不会将数字转换为科学符号。请描述一下你所观察到的导致你得出结论的原因。@Robᵩ Python确实转换为科学符号。您在示例中使用了整数,为了能够观察这种效果,您需要使用带有一定小数位数的浮点。请包括一个完整的可运行示例。目前还不清楚数据与list\u to\u csv
函数的关系,也不清楚是什么让您认为Python将数字转换为科学符号。从中可以看出,Python不会将数字转换为科学符号。请描述一下你所观察到的导致你得出结论的原因。@Robᵩ Python确实转换为科学符号。您在示例中使用了整数,为了能够观察这种效果,您需要使用带有一定小数位数的浮点