numpy
江浙沪讲吴语
这个作者很懒,什么都没留下…
展开
-
Python报错:local variable referenced before assignment
原因是在定义函数时,使用了与全局变量同名的局部变量a = 10b = 10def func(): if b == 5: a = 5 print(a)funk = func()这时会报错 ‘UnboundLocalError: local variable ‘a’ referenced before assignment’因为函数内部定义了一个与外部变量同名的变量,此时函数会把这个变量定义为局部变量,如果没有赋值则不能调用它。...原创 2022-02-19 20:01:10 · 18022 阅读 · 0 评论 -
list to array 报错 VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
报错信息:VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify ‘dtype=object’ when creati原创 2021-09-28 22:48:40 · 480 阅读 · 0 评论