2022-01-27 21:21:25 +08:00
|
|
|
# -*- conding: utf8 -*-
|
|
|
|
|
2022-01-28 18:29:51 +08:00
|
|
|
import os
|
2022-01-27 21:21:25 +08:00
|
|
|
from msctspt.funcOpera import keepart
|
|
|
|
|
2022-01-28 18:29:51 +08:00
|
|
|
m = 0
|
2022-01-27 21:21:25 +08:00
|
|
|
|
2022-01-28 18:29:51 +08:00
|
|
|
for path, dir_list, file_list in os.walk(r"./"):
|
|
|
|
for file_name in file_list:
|
|
|
|
if keepart(file_name, '.', None) == '.py':
|
2022-01-27 21:21:25 +08:00
|
|
|
file = os.path.join(path, file_name)
|
2022-01-28 18:29:51 +08:00
|
|
|
print("得到文件名:" + str(file))
|
|
|
|
for i in open(file, 'r', encoding="utf-8"):
|
|
|
|
code = i.replace(' ', '').replace('\n', '')
|
2022-03-06 23:40:31 +08:00
|
|
|
|
|
|
|
if code.startswith('#'):
|
|
|
|
continue
|
2022-01-27 21:21:25 +08:00
|
|
|
if code:
|
2022-01-28 18:29:51 +08:00
|
|
|
print("\t" + code)
|
|
|
|
m += 1
|
2022-01-27 21:21:25 +08:00
|
|
|
else:
|
|
|
|
pass
|
|
|
|
|
2022-01-28 18:29:51 +08:00
|
|
|
input("\n最终代码行数为:" + str(m))
|