Retrieve all data in column1 and column2

1810 views python
1

Goal:
Retrieve all data in the first and second column only and put it into a single variable.

Problem:
How should i retrieve all data in column 1 and column2?

Info:
*I'm newbie in python
*I'm using Jupiter

enter image description here

answered question

2 Answers

9

If you want a string from each column

var1 = ''.join(data[0])
var2 = ''.join(data[1])

posted this
0

I assume you want all values from column 1 in one variable and all values from column 2 in another variable?

column1 = [row[0] for row in data]  # makes a list of all values of column 1
column2 = [row[1] for row in data]  # does the same for column 2

posted this

Have an answer?

JD

Please login first before posting an answer.