Hi Bumsfeld, thanks for sharing, I haven't come across this before
# works on Windows or Linux, also Vista import os os.system(['clear','cls'][os.name == 'nt'])
Can please tell me how is the following code is working. I mean,
>>> ['clear','cls'] [True] 'cls' >>> ['clear','cls'] [False] 'clear' >>> ['a','b']['some_string' == r'some_string'] 'b' >>> ['a','b']['some_string' == r'somestring'] 'a' >>>
is list and [True] is also another list, what is happening here? I have no knowledge on this, could please let me know what is happening?
Thanks in advance,
Sorry kath, moved this out of 'Starting Python' the rules there are ...
The idea of this thread is to help the beginning Python programmer with hints and helpful code. Please feel free to contribute! If you have any questions start your own thread!