亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法識別 Python 的函數 update()

無法識別 Python 的函數 update()

海綿寶寶撒 2021-09-14 10:32:28
def updateTheme(self, id, new_theme):    theme = Theme.query.filter_by(id = id).first()    theme.update(new_theme)    db.session.commit()錯誤:“主題”對象沒有屬性“更新”這是它應該如何工作:theme = Theme(name = "osman")new_theme = Theme(name = "miras")theme.update(new_theme)print(theme) # osman have to be changed to miras即使我可以這樣做:theme.name = "miras"當我必須使用多個參數時,如姓名、姓氏、電話。此外,updateTheme 并不總是提供所有參數(姓名、姓氏、電話),它應該只更新提供的參數。例如:person = {name: "john", surname: "smith", phone: 12345, country: "USA"}update_person = {country: "Portugal"}person.update(update_person) # should change only country
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 181 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號