I have multiple 1-element lists that I wish to convert into 1 single list:
Current lists:
['orange']
['apple']
['grape']
['banana']
['mango']
Wish to have an output like this:
['orannge', 'apple', 'grape', 'banana', 'mango']
My purpose is to write those array with 1x3 into a csv file
Here is Code:
import csv
#import numpy as np
f1 = open('out.csv')
data = csv.reader(f1, delimiter=':')
print (data)
for row in data:
#print(row)
modules = print(row[2:])
#for row in module:
result = [[0,0]]
# iterate through rows
for i in modules:
# iterate through columns
for j in modules[0]:
result[j][i] = X[i][j]
for r in result:
print(r)
#Try with zip/map
#print(map(data,zip(*module))
#with open('test.csv', 'wb') as f:
#writer = csv.writer(f)
#for row in module:
#writer.writerow(module)
f1.close()