26 lines
825 B
Python
26 lines
825 B
Python
import os
|
|
|
|
search_string = "分析商品销售数据和趋势"
|
|
utf8_bytes = search_string.encode('utf-8')
|
|
gbk_bytes = search_string.encode('gbk')
|
|
|
|
found_files = []
|
|
|
|
for root, dirs, files in os.walk('.'):
|
|
for file in files:
|
|
if file.endswith(('.uvue', '.md', '.json', '.js', '.uts', '.ts')):
|
|
filepath = os.path.join(root, file)
|
|
abs_path = os.path.abspath(filepath)
|
|
try:
|
|
with open(filepath, 'rb') as f:
|
|
content = f.read()
|
|
if utf8_bytes in content:
|
|
found_files.append((abs_path, 'UTF-8'))
|
|
elif gbk_bytes in content:
|
|
found_files.append((abs_path, 'GBK'))
|
|
except Exception:
|
|
pass
|
|
|
|
for path, enc in found_files:
|
|
print(f"{path}")
|