OS: Windows 10 Enterprise,巨蟒:Python 3.6.4,PYQ: pyq (4.1.4)。我很確定我的數(shù)據(jù)類型是正確的,盡管_k.error: type當(dāng)我嘗試更新插入到我的表時(shí)我一直收到。首先,我使用以下命令初始化表...q.set(':testTable', q('!', ["Key", "Status", "Descr", "FileName"], [K.long([]), K.int([]), K.char([]), K.symbol([])]).flip)檢查表元...q.get(':testTable').meta.show()c | t f a--------| -----Key | jStatus | iDescr | cFileName| s我在 python 中設(shè)置了一些示例變量并將它們分別存儲(chǔ)在列表和字典中......key = 42status = 3descr = "h"fn = "cymbeline"data = [key, status, descr, fn]data_dict = {a:b for a, b in zip(['Key', 'Status', 'Descr', 'FileName'], data)}然后我嘗試向表中插入,分別使用以下每個(gè)命令......q.upsert(':testTable', data)q.upsert(':testTable', data_dict)但是,它們都失敗并顯示相同的_k.error: type消息。我認(rèn)為這里有一個(gè)簡(jiǎn)單的解決方案,但我似乎無法弄清楚。先感謝您。
1 回答

繁花不似錦
TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊
您需要將 descr 顯式轉(zhuǎn)換為 K.char 類型:
descr = K.char("h")
否則它會(huì)被隱式轉(zhuǎn)換為一個(gè)符號(hào),你會(huì)得到一個(gè)類型錯(cuò)誤。
添加回答
舉報(bào)
0/150
提交
取消