May-06-2018, 09:28 AM
(May-06-2018, 02:06 AM)shakir_abdul_ahad Wrote: One question; after looking at the last part of your code, beginning on like 32, how would I have known to do that? Being a noob and all. Thanks again.Well... have you seen this in the python documentation
Quote:keep this under your pillowit is not a joke.
Really that part off the code will not look so special to you in a few weeks using python. It has different just my use of the continue to quickly discard the non interesting passes of a loop -other people prefer using an if-then-else, is just your preference- and the break to stop testing once the file is already moved. The rest is just read the os entry in the python library.
One thing that is really important and does not look part of the code are the comments. My professional code has even more comments, describing what I expect to find in each part of the code a little bit complex. Always think that your code must be understood -and fixed- by someone who has less experience than you...
When you plan to use something complex (like the nested for loops in the previous code or a long regex) write the comment before the writing code. If you cannot summarise it in a few sentences, your code will be too complex and might backfire in any moment.
Good luck learning python!