(Oct-13-2018, 05:46 PM)Larz60+ Wrote: get is for java in python use:Larz, OP meansvalue = your_dict[your_key]
dic.get(key[,defualt]) method
@OP: what it does is to return default value if key is not present in the dict. If you don't use it, in this case you will get KeyError. So it's a nice way to return default value instead of getting error.
Now, think how you can replace the if statement using dict.get()
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs