21 lines
581 B
Python
21 lines
581 B
Python
import pandas as pd
|
|
import os
|
|
current_dir = os.getcwd()
|
|
|
|
def count_web():
|
|
total = 0
|
|
web_dir = os.path.join(current_dir, 'web_dir')
|
|
for file in os.listdir(web_dir):
|
|
try:
|
|
df = pd.read_excel(os.path.join(web_dir, file))
|
|
except pd.errors.EmptyDataError:
|
|
pass
|
|
total = total + len(df)
|
|
print(file, total)
|
|
return total
|
|
|
|
def count_wechat():
|
|
articles_full_path = os.path.join(current_dir, 'wechat_dir/articles_full.csv')
|
|
df = pd.read_csv(articles_full_path)
|
|
return len(df)
|
|
print(count_web(), count_wechat()) |