This is a simple example of getting xxx values in column1 and yyy values in column2.
Attention! Your file data should look something like this:
xxx yyy xxx yyy xxx yyy
4 (xxx yyy xxx yyy) 1 (xxx yyy)
, , :
, /, /,
data_separator=',' column_separator='/'
-/-/-
data_separator='-' column_separator='/'
def read(file):
column1=[]
column2= []
readfile = open(file, 'r')
data_separator = ' '
column_separator = ' '
for line in readfile.readlines():
line = line.rstrip('\n')
print line
columns = line.split(column_separator)
for column in columns:
if not column: continue
column1.append(column.split(data_separator)[0])
column2.append(column.split(data_separator)[1])
readfile.close()
, xxx yyy aaa bbb ttt hhh , :
column1 = ['xxx', 'aaa', 'ttt']
column2 = ['yyy', 'bbb', 'hhh']