给定数据结构,在Python中读取.txt文件

时间:2019-06-07 14:52:11

标签: python text

我有一个要在Python中读取的文本文件。这是第一行:

first_line = (f.readline())
first_line

输出: 'P,5.000000,5.000000,15.000000,60.000000,5.000000,15.000000,60.000000,-20.000000,-0.000000,-4.000000,-10.000000,-3.000000,-24.000000,-0.000000,0.000000,0,0.200000,20.000000,1.000000\n'

我对此行有以下描述,我不知道使用哪种语言。您能帮我用下面的相关名称将每个数字创建为参数吗?

str_Input_Data += "P," +
to_string(_IHVS_MINIMUM_ACTIVITY_DURATION ) + "," +
to_string(_IHVS_FLEXIBILITY_START_LOW ) + "," +
to_string(_IHVS_FLEXIBILITY_START_MEDIUM ) + "," +
to_string(_IHVS_FLEXIBILITY_START_HIGH ) + "," +
to_string(_IHVS_FLEXIBILITY_DURATION_LOW ) + "," +
to_string(_IHVS_FLEXIBILITY_DURATION_MEDIUM ) + "," +
to_string(_IHVS_FLEXIBILITY_DURATION_HIGH ) + "," +
to_string(_IHVS_COST_AV_FIXED ) + "," +
to_string(_IHVS_COST_PARKING_PER_HOUR ) + "," +
to_string(_IHVS_COST_AV_ENERGY_PER_HOUR ) + "," +
to_string(_IHVS_COST_VALUE_OF_TIME_PER_HOUR ) + "," +
to_string(_IHVS_COST_TAXI_FIXED ) + "," +
to_string(_IHVS_COST_TAXI_PER_HOUR ) + "," +
to_string(_IHVS_COST_ZOV_TAX_PER_HOUR ) + "," +
to_string(_IHVS_COST_ZOV_TAX_FIXED ) + "," +
to_string(_IHVS_GENERATE_VISUALIZATION_FILE) + "," +
to_string(_IHVS_MIPGAP) + "," +
to_string(_IHVS_TIMEOUT) + "," +
to_string(_IHVS_THREAD) +

谢谢!

0 个答案:

没有答案