@@ -115,27 +115,27 @@ def number_to_hex(row, write_mode, conversion_mode):
115115 # new_row = '"' + from_ip + '","' + to_ip + '","' + remaining_columns
116116 if sys .version < '3' :
117117 if remaining_columns == '' :
118- new_row = '"' + from_hex + '","' + to_hex + '"'
118+ new_row = '"' + from_hex + '","' + to_hex + '"\n '
119119 else :
120- new_row = '"' + from_hex + '","' + to_hex + '","' + remaining_columns
120+ new_row = '"' + from_hex + '","' + to_hex + '","' + remaining_columns + ' \n '
121121 else :
122122 if remaining_columns == '' :
123- new_row = '"' + str (from_hex ) + '","' + str (to_hex ) + '"'
123+ new_row = '"' + str (from_hex ) + '","' + str (to_hex ) + '"\n '
124124 else :
125- new_row = '"' + str (from_hex ) + '","' + str (to_hex ) + '","' + remaining_columns
125+ new_row = '"' + str (from_hex ) + '","' + str (to_hex ) + '","' + remaining_columns + ' \n '
126126 # print (new_row)
127127 elif (write_mode == 'append' ):
128128 # new_row = '"' + row[0] + '","' + row[1] + '","' + from_ip + '","' + to_ip + '","' + remaining_columns
129129 if sys .version < '3' :
130130 if remaining_columns == '' :
131- new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + from_hex + '","' + to_hex + '"'
131+ new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + from_hex + '","' + to_hex + '"\n '
132132 else :
133- new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + from_hex + '","' + to_hex + '","' + remaining_columns
133+ new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + from_hex + '","' + to_hex + '","' + remaining_columns + ' \n '
134134 else :
135135 if remaining_columns == '' :
136- new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + str (from_hex ) + '","' + str (to_hex ) + '"'
136+ new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + str (from_hex ) + '","' + str (to_hex ) + '"\n '
137137 else :
138- new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + str (from_hex ) + '","' + str (to_hex ) + '","' + remaining_columns
138+ new_row = '"' + row [0 ] + '","' + row [1 ] + '","' + str (from_hex ) + '","' + str (to_hex ) + '","' + remaining_columns + ' \n '
139139 return new_row
140140
141141def convert_to_csv (input_file , output_file , conversion_mode , write_mode ):
@@ -169,7 +169,7 @@ def convert_to_csv(input_file, output_file, conversion_mode, write_mode):
169169
170170 if (len (my_list ) > 0 ):
171171 with open (output_file , 'a' ) as myWrite :
172- myWrite .writelines ( "{} \n " . format ( x ) for x in my_list )
172+ myWrite .write ( '' . join ( my_list ) )
173173
174174 my_list = []
175175
0 commit comments