Skip to content

Commit f902155

Browse files
committed
file characters and lines
1 parent b2d0630 commit f902155

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lab-12/file-stats.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import os
2+
def stats(file_path):
3+
file = open(file_path, "r")
4+
file_data = file.read()
5+
file_characters = len(file_data)
6+
file_lines = int(sum(1 for line in file_data) / 10)
7+
8+
stats(os.path.expanduser('~') + "\\src\\python-programming\\lab-12\\test.txt")

0 commit comments

Comments
 (0)