Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Peewee不';不要创建数据库_Python_Database_Python 3.x_Peewee - Fatal编程技术网

Python Peewee不';不要创建数据库

Python Peewee不';不要创建数据库,python,database,python-3.x,peewee,Python,Database,Python 3.x,Peewee,Python 3.6。我正在通过一些教程学习如何使用peewee。使用下面的代码,我应该能够在脚本所在的文件夹中看到'students.db',但是当我运行代码时,没有出现错误,但是我没有看到在该文件夹中创建的任何数据库。有什么想法吗?谢谢 import peewee as pw db = pw.SqliteDatabase('students.db') class Student(pw.Model): username = pw.CharField(max_length=255,

Python 3.6。我正在通过一些教程学习如何使用peewee。使用下面的代码,我应该能够在脚本所在的文件夹中看到'students.db',但是当我运行代码时,没有出现错误,但是我没有看到在该文件夹中创建的任何数据库。有什么想法吗?谢谢

import peewee as pw

db = pw.SqliteDatabase('students.db')

class Student(pw.Model):
    username = pw.CharField(max_length=255, unique=True)
    points = pw.IntegerField(default=0)

    class Meta:
        database = db

if __name__ == 'main':
    db.connect()
    db.create_tables([Student], safe=True)

将main更改为
\uuuu main\uuuu

if __name__ == '__main__':
    db.connect()
    db.create_tables([Student], safe=True)