Skip to content

Commit 6eacf01

Browse files
authored
Merge pull request Rishi098#39 from Mownika07/patch-3
Create CountofLine.py
2 parents fef9ded + 9825678 commit 6eacf01

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

CountofLine.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def file_len(fname):
2+
with open(fname) as f:
3+
for i, l in enumerate(f):
4+
pass
5+
return i + 1
6+
7+
print(file_len("my_file.txt")) //print the lenght of text in file

0 commit comments

Comments
 (0)