现在再自学Python3.0爬虫,源代码如下: import pymysql db = pymysql.connect(host='localhost',user='root',password='123456',port=3306) cursor = db.cursor() cursor.execute('SELECT VERSION()') data = cursor.fetchone() print('Database version:',data) cursor.execute("CREATE DATABASE spiders DEFAULT CHARACTER SET utf8") db.close() 运行结果如下: Database version: ('8.0.13',) Traceback (most recent call last): File "C:\Users\yuxiaofeng1229\Desktop\lianxi.py", line 12, in <module> cursor.execute("CREATE DATABASE spiders DEFAULT CHARACTER SET utf8") File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\cursors.py", line 170, in execute result = self._query(query) File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\cursors.py", line 328, in _query conn.query(q) File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 516, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 727, in _read_query_result result.read() File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 1066, in read first_packet = self.connection._read_packet() File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\connections.py", line 683, in _read_packet packet.check_error() File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "C:\Users\yuxiaofeng1229\AppData\Local\Programs\Python\Python36\lib\site-packages\pymysql\err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.ProgrammingError: (1007, "Can't create database 'spiders'; database exists") 下面这些问题是什么问题呢?应该怎么修改哈?
pardon110