-7

Could someone please explain the difference between these two?

data=[]
for row in csv_file_object: 
    data.append(row[1:]) 

and

data=[]
for row in csv_file_object:
    data.append(row)
blzn
  • 75
  • 1
  • 10
  • 6
    Try it and you'll know. – Maroun Jul 17 '13 at 05:32
  • Try running the code. – Blender Jul 17 '13 at 05:32
  • You may also consider trying to use a more descriptive title in the future. This has three advantages: 1) it will be more helpful to future uses searching for relevant questions, 2) people of knowledge can better find your question to answer, and 3) when typing in your more descriptive title, suggested questions that have already been asked would have popped up and you would have seen that this has already been asked before. – SethMMorton Jul 17 '13 at 06:16

2 Answers2

1

Assuming row = [1,2,3]:

Then:

row[1:] will be [2,3]

and

row will be [1,2,3]

matcauthon
  • 2,261
  • 1
  • 24
  • 41
1

The former does not include the first element.

Explaination

Mikkel Løkke
  • 3,710
  • 23
  • 37