fix some bugs

This commit is contained in:
岛风 2019-09-10 00:56:27 +08:00
parent 48ea3536cf
commit 2a5c032013
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,8 @@ from DoubanSpider import *
from DoubanSpider.db import Douban, engine, Recording
from sqlalchemy.orm import sessionmaker
logger = logging.getLogger("PAPA")
class DoubanBook(object):
def __init__(self):
@ -108,7 +110,8 @@ class DoubanBook(object):
print(f'正在保存:{name}')
self.save_csv(data)
def save_csv(self, data):
@staticmethod
def save_csv(data):
with open('results.csv', 'a', encoding='utf-8') as f:
writer = csv.writer(f)
writer.writerow(data)

View File

@ -28,7 +28,6 @@ def url_pool():
if __name__ == '__main__':
logger = logging.getLogger("PAPA")
sleeptime = random.randint(0, 3)
with open("results.csv", "a", encoding='utf-8') as f:
writer = csv.writer(f)