diff --git a/spider/article.csv b/spider/article.csv deleted file mode 100644 index a481b83..0000000 --- a/spider/article.csv +++ /dev/null @@ -1 +0,0 @@ -id,likeNum,commentsLen,reposts_count,region,content,contentLen,created_at,type,detailUrl,authorAvatar,authorName,authorDetail,isVip diff --git a/spider/saveData.py b/spider/saveData.py index 7bcf35d..e688541 100644 --- a/spider/saveData.py +++ b/spider/saveData.py @@ -20,13 +20,13 @@ def save_to_sql(): concatArticlePd.to_sql('article', con=engine, if_exists='replace', index=False) concatCommentsPd.to_sql('comments', con=engine, if_exists='replace', index=False) except: - articleNewPd = pd.read_csv('articleData.csv') - commentNewPd = pd.read_csv('articleComments.csv') + articleNewPd = pd.read_csv('article.csv') + commentNewPd = pd.read_csv('comments.csv') articleNewPd.to_sql('article',con=engine,if_exists='replace',index=False) commentNewPd.to_sql('comments',con=engine,if_exists='replace',index=False) - os.remove('./articleData.csv') - os.remove('./articleComments.csv') + os.remove('./article.csv') + os.remove('./comments.csv') if __name__ == '__main__': save_to_sql() \ No newline at end of file