Home > other >  if a !=[] and if len is the difference between (a)?
if a !=[] and if len is the difference between (a)?

Time:11-29

Beginners pyqt5, created a button is always one click is stuck, not an error, got to try out a day, but still a little don't understand
Specific so I wrote the original judgment is the if self. The data!=[] : pycharm suggestion to the if self. Data: and then I will go wrong; Try to change conditions to the if len (self) data) : just by the way, the difference between the two, please?

CodePudding user response:

These grammar are set up, should not only this kind of problem.

CodePudding user response:

Both:
 if self data!=[] : 

Or:
 if len (self. Data) : 


You should be:
Real-time debugging, confirm the self. The data what is the value of the

- "then screenshots out to help you analyze the reason,

If you own self. The data is [] so the above two kinds of writing are equivalent
- "is not the same as shown from the results of your self. The data is not really []

So, more should go to real-time debugging, make clear what value is

CodePudding user response:

A list is whether the judgment is empty
One is whether the length is zero
  • Related