Throughout this book you may be find yourself repeating some of the same tasks over and over again. Why not use the knowledge you gained to create programs that help you as you work your way through? Here are some ideas that you can do. I've also include my codes for these, but as always, I encourage you to attempt to write some yoursel, first! You may come up with a much better code than I use.
- Do you answer the practice questions at the end of each chapter in the book? Personally, I like to create a new Python file in Pycharm so everything is organized. Copying and pasting the questions into an IDE will cause it to not be very readable since it will show all the "errors."
See if you can write a code that takes the clipboard after copying all the questions, deletes the Q, and just leaves the numbers with the questions as well as adding # before each line to comment it out. This way it's readable in the IDE, then if you want to execute code to answer the question you can do so without a problem.
See 'Practice Questions' for my solution
- I like to organize each chapter in a new project in PyCharm. This means every file in each project will be set to that working directly unless specified. There are some programs I actually want to keep and run at a later time without wanting to go into the directory. I created a new folder called 'MyPythonScripts' that stores all of these. I also set my Environmental Variables to include that path so I can use Win+R to run these programs. Appendix B will show you how to do this. This means you also need to create a .bat file for each program you want to run.
Write a program that automatically copies a .py file, moves it into a specific directory of your choosing, and automatically creates a .bat file so you don't have to do this manually every time.
See 'Py Copy' for my solution.
- This course contains a few zip files. You will probably get multiple other zip files as well. Write a program to zip your a file to a specific location.
See 'Zip' for my solution
- Have you made it to the Chapter 13 and began working with PDF documents? How annoying is it when you're testing out your program over and over for encrypting and decrypting and running into issues because both exist in one directory?
Write a program that automatically deletes all encrypted files ending with encrypted.pdf or decrypted.pdf. This will make PDF Paranoia much easier to work with. You can test PDF paranoia, then just run your new program to put the folder back to how it was originally, make your changes, and repeat. This keeps you from having to open each folder manually and deleting each one.
See 'Delete Encrypted' for my solution