takes 0 positional arguments but 1 was given
takes 0 positional arguments but 1 was given
剛剛在跟著敲程式碼的時候,碰到了這個報錯。
>>> def self_float():
try:
return float(obj)
except ValueError:
retval = none
return retval
>>> self_float(1.234)
Traceback (most recent call last):
File "<pyshell#100>", line 1, in <module>
self_float(1.234)
TypeError: self_float() takes 0 positional arguments but 1 was given
然後自己百度了一下,發現是自定義函式裡面沒有帶引數
>>> def self_float(obj):
try:
return float(obj)
except ValueError:
retval = none
return retval
>>> self_float(1234)
1234.0
這樣就沒有報錯了。
相關文章
- main() takes 0 positional arguments but 1 was givenAI
- Python 錯誤之函式takes 0 positional arguments but 1 was givenPython函式
- Python3類方法報錯takes 0 positional arguments but 1 was givenPython
- bam檔案出錯行(takes from 3 to 5 positional arguments but 6 were given)
- 【已解決】TypeError: __init__() takes 1 positional argument but 2 were givenError
- ORA-00600: internal error code, arguments: [2103], [1], [0], [1], [900], [], [],Error
- 記一次ORA-00600: internal error code, arguments: [kcbz_check_objd_typ], [0], [0], [1], [], [], [], []ErrorOBJ
- 023 Given an integer n. get the number of 0, 2, 4 from all the values from [0, n]
- TypeError: object() takes no parametersErrorObject
- ORA-00600: internal error code, arguments: [2662], [0],Error
- 解決The given version [xx] is not supported, only version 1 to 10 is supported in this buildUI
- ORA-00600: internal error code, arguments: [kqlnrc_1], [0x70000029A6C9410], [],Error
- 修改cursor_sharing引數引發的ORA-00600: internal error code, arguments: [qctcte1], [0], []..Error
- TextInput should be given height
- Python成功解決TypeError: __init__() missing 1 required positional argument: ‘comment‘PythonErrorUI
- ORA-00600: internal error code, arguments: [1883], [0x000000000], [], [], [], []Error
- raid1+0 and raid0+1AI
- Function.caller, arguments.caller, arguments.callee, arguments.callee.calllerFunction
- takes_ownership(s)語句執行
- ORACLE ORA-00600之[kkoipt:incorrect pwj], [0], [0], [0], [2], [1], [1]Oracle
- ORA-00600: internal error code, arguments: [17285], [0x110465BD0], [4294967295],[0x7000000FADA7E58],Error
- ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [ErrorAST
- ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],ErrorAST
- ORA-00600: internal error code, arguments: [ksuinfos_modact1]ErrorUI
- SlZORk9SMkRMSVpUR1VDQ0tWTUZDTVNNSkZHVU1WS0hJTk5GSVRLTklaS0ZRTVI1SFU2UQ==VR
- Python中小錯誤 之 object() takes no parametersPythonObject
- Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticateServerlocalhost
- 搞定request.getRemoteAddr()獲取的值為0:0:0:0:0:0:0:1REM
- JS的argumentsJS
- JavaScript arguments 物件JavaScript物件
- JavaScript之argumentsJavaScript
- JavaScript中argumentsJavaScript
- ORA-00600: internal error code, arguments: [kcblasm_1], [103], []ErrorASM
- RAID 1+0和RAID 0+1的區別AI
- HttpServletRequest呼叫getRemoteAddr獲取IP返回0:0:0:0:0:0:0:1的問題HTTPServletREM
- Raid Raid0 Raid1 Raid5 Raid0+1 Raid1+0AI
- Python基礎——positional argument vs keyword argumentPython
- org.hibernate.QueryException:Expected positional parameter count: 4Exception