#๐ Looking for a little info
9 messages ยท Page 1 of 1 (latest)
Hey @elder quail!
Add a py after the three backticks.
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
@elder quail
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
jkl
import csv
with open('StudentInfo.tsv', 'r') as file:
data = csv.reader(file, delimiter='\t')
test_1 = []
test_2 = []
test_3 = []
for row in data:
test_1.append(row[2])
print(test_1)
for row in data:
test_2.append(row[3])
print(test_2)
for row in data:
test_3.append(row[4])
print(test_3)
the first loop works and creates the test_1 list I want but the other two are empty. What am I missing?
You will need to do file.seek(0) to move the file pointer back to the start of the file after looping through it, or do all 3 operations in 1 loop through the file
doh... completely forgot. thank you
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.