This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/04-CustomLibrary/Library/fileOperations.py

27 lines
655 B
Python

def CountLines(fname):
count = 0
with open(fname, 'rb') as f:
for file_line in f:
file_line = file_line.strip()
# print(file_line)
# 空行
if file_line == b'':
pass
# 注释 # 开头
elif file_line.startswith(b'-->'):
pass
# 代码
else:
count += 1
print(fname + '----', count)
# 单个文件行数
# print(fname,'----count:',count)
return count
def WriteBinary(response,path1):
with open(path1,"wb") as f2:
strb = response
f2.write(strb)