Skip to content

Tag: python

No such file or directory error

This is the error I am getting: And this is my code: The E:/stuff/log.txt file exists. I can navigate in Windows Explorer and open it so why can’t I open it? EDIT: Output of DIR command: I am running the python script from the cmd like this: Answer Firstly, from above, Windows supports / just fine. Seco…

Print all variables in a class? – Python

I’m making a program that can access data stored inside a class. So for example I have this class: So using this I can call out a single variable like: But if I wanted to print all variables, I’m a little lost. If I run: I get: But I want to be able to print the actual data of those.

False or None vs. None or False

This behaviour confuses me. Could someone explain to me why is this happening like this? I expected them to both behave the same. Answer The expression x or y evaluates to x if x is true, or y if x is false. Note that “true” and “false” in the above sentence are talking about “tr…