[問題] 為什麼有動作,但還是空白

看板Python作者 (YY)時間2年前 (2022/02/01 18:06), 2年前編輯推噓2(209)
留言11則, 3人參與, 2年前最新討論串1/3 (看更多)
以下附上我的code https://gist.github.com/cj044/279f792a216ee82b25d47cfd28fdda88 還有CSV 檔案 https://gist.github.com/cj044/8bb2ece639dae63fc59fa9dcce4e1716 https://github.com/cj044/VIP-HW (UI檔案) Q1: 比較有問題的是 47 ~ 60 def All_class(self): #讀取全部的學生名單,存在列表裡 ..................... self.ui.listView1.setModel(qlist) 每次build https://imgur.com/U3QMTlr
Q2: 再來debug的時候 看到 https://imgur.com/1WvkoK7
實在看不懂橘色框框的東西 self : < __main ___ 這樣無助於我解bug Q3: Gituub All gists 的兩個檔案 https://gist.github.com/cj044/279f792a216ee82b25d47cfd28fdda88 還有CSV 檔案 https://gist.github.com/cj044/8bb2ece639dae63fc59fa9dcce4e1716 該如何跟 https://github.com/cj044/VIP-HW 放在同一個資料檔? 解了三天,google python qlist = QStringListModel() 還是無解? 只得到這個 https://its401.com/article/LaoYuanPython/104050416 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.137.56.150 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1643709986.A.D08.html

02/01 20:18, 2年前 , 1F
54行 必須是self.class_info.extend(row)
02/01 20:18, 1F

02/01 20:19, 2年前 , 2F
你也搞錯append的用法
02/01 20:19, 2F
大大感謝! 但是為什麼是extend? 我都只看過 append! 不知道有沒有參考文件? 謝謝! 我google 三天全找不到.....

02/02 04:16, 2年前 , 3F
Google list.append 跟 list.extend 就有了啊?不然就直接
02/02 04:16, 3F

02/02 04:16, 2年前 , 4F
看官方文件裡面 list 的部份啊
02/02 04:16, 4F

02/02 04:17, 2年前 , 5F
要更明顯兩者比較的文章也很容易找啊,例如:
02/02 04:17, 5F

02/02 04:18, 2年前 , 6F
02/02 04:18, 6F
我 gooogle python qlist = QStringListModel() 這東西3天! 完全不知道有 list.extend 這東西!

02/02 10:41, 2年前 , 7F
你還在五年前那家公司嗎?
02/02 10:41, 7F

02/02 10:52, 2年前 , 8F
問題是Qstringlist只讀List[str] 但在row in rows 的
02/02 10:52, 8F

02/02 10:52, 2年前 , 9F
loop中 row是list[str] 直接append會變成list[list]
02/02 10:52, 9F

02/02 10:53, 2年前 , 10F
所以我才說你要改成extend(row) 原始的code則是邏輯
02/02 10:53, 10F

02/02 10:54, 2年前 , 11F
不通,才建議你看一下append怎麼用..
02/02 10:54, 11F
3Q! 我會再看看的,問題已經解決! 大大速度好快,一下破解我的問題! 靜待我了解後,在跟大大討論! ※ 編輯: euser1777 (101.137.227.41 臺灣), 02/03/2022 21:17:07
文章代碼(AID): #1X-GOYq8 (Python)
文章代碼(AID): #1X-GOYq8 (Python)