local variable 'CCC2' referenced before assignment
时间: 2023-10-23 12:24:36 浏览: 43
This error occurs when you try to use a variable that has not been assigned a value yet. This can happen if the variable is defined inside a function and you try to use it outside the function.
For example:
```
def my_function():
CCC1 = 10
print(CCC1)
my_function()
print(CCC1)
```
In this code, `CCC1` is defined inside the `my_function()` function. When the function is called, it prints the value of `CCC1` as 10. However, when you try to print `CCC1` outside the function, you get the "referenced before assignment" error because `CCC1` is not defined outside the function.
To fix this error, you need to make sure that the variable is assigned a value before you try to use it. You can either define the variable outside the function or assign it a value inside the function before you try to use it outside the function.