belongs_to :guest, :class_name => 'Guest', :foreign_key => 'guest_id'
belongs_to :guest2, :class_name => 'Guest', :foreign_key => 'guest2_id'
当我运行程序时,我有这些错误TypeError:sequence item 0:expect str instance,int found.How我能解决吗?
答案 0 :(得分:0)
您需要sub
函数的字符串,以修复您可以将字典的值更改为字符串:
dic1[(char)]=str(position)
或将lambda
功能更改为:
result = pattern.sub(lambda x: str(dic[x.group()]), s)