ValueError: not enough values to unpack (expected 4, got 3)
时间: 2023-09-05 15:08:36 浏览: 88
This error occurs when you try to unpack more values than there are in a sequence. In this specific case, the error message is telling you that you expected to unpack four values, but only three were provided.
For example, if you have a tuple with three values:
```
my_tuple = (1, 2, 3)
```
And you try to unpack it into four variables:
```
a, b, c, d = my_tuple
```
You will get the "ValueError: not enough values to unpack (expected 4, got 3)" error because there are only three values in the tuple, but you are trying to unpack it into four variables.
To fix this error, make sure that the number of variables you are unpacking the sequence into matches the number of values in the sequence.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)