学习python的早期阶段,我遇到了问题。我正在建立一个骰子游戏。我希望将dice [0]的值传递给holdDie1函数。我创建的标签准确显示了dice [0]的正确值,但是当我用bind调用该函数将其分配给另一个列表时,我收到一个错误:
第75行,在holdDie1中 keep [0] =骰子[0] TypeError:'事件' object不支持索引
public class TenantContext : DbContext
{
public TenantContext(string connection, Tenanat tenanat)
: base(connection)
{
//create DB for tenant
Database.CreateIfNotExists();
//create user for the new Db
string sql = "CREATE LOGIN \"" + tenanat.Email + "\" WITH PASSWORD = '" + tenanat.Password + "'; USE " + tenanat.Name + "; CREATE USER \"" + tenanat.Email + "\" FOR LOGIN \"" + tenanat.Email + "\" WITH DEFAULT_SCHEMA = dbo;";
Database.ExecuteSqlCommand(sql);
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
public DbSet<Product> Products { get; set; }
public DbSet<Order> Orders { get; set; }
}}