Skip to content

Commit 2ef68f1

Browse files
committed
basic reading from a file
Signed-off-by: Adam McNicol <[email protected]>
0 parents  commit 2ef68f1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Files/animals.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
antelope
2+
bear
3+
cat
4+
dog
5+
elephant
6+
fox
7+
giraffe
8+
hyena
9+
iguana
10+
jaguar
11+
kangaroo
12+
llama
13+
monkey
14+
ninja turtle
15+
octopus
16+
platterpus
17+
queen bee
18+
rat
19+
snake
20+
tiger
21+
unicorn
22+
vole
23+
whale
24+
xibit
25+
yak
26+
zebra

Files/read_file.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
with open("animals.txt", mode="r",encoding="utf-8") as my_file:
2+
for line in my_file:
3+
print(line)

0 commit comments

Comments
 (0)