DEV Community

Automating my workflow with Python #1: File Organizer

Gagan Deep Singh on August 25, 2020

This is my first article on Automating my workflow with Python. In this (beginner-friendly) article, you will learn how you can make your own Pyth...
Collapse
 
titanhero profile image
Lex • Edited

Cool, I have very long time without code in python in an extended way, so things like this help me a lot to remember, but I have a thing that I didn't understood in here, in your condition to handle your exception with the length of arguments in a print function you use the character f before the text string, here:

print(f"[Usage] python {Path("

what does the "f"?

Collapse
 
gagangulyani profile image
Gagan Deep Singh

f-strings (formatted strings) are new in Python 3 😎 They make string formatting a lot easier. I could have used format function instead of using f as a prefix but just by adding that, I get to write cleaner and more readable code.

Collapse
 
titanhero profile image
Lex

Yeah already I I read about f strings, them are amazing...πŸ‘βœŒοΈ

Collapse
 
designeranna1 profile image
Designer Anna

Nice Article. πŸ‘
How about taking it a step further, where you don't need to run the script manually.
And the script will run automatically whenever a file is saved in the 'downloads' folder.

Collapse
 
gagangulyani profile image
Gagan Deep Singh

Thank you! I was thinking to do so but it will be a mess if I want to drag and drop the recently downloaded file from within the browser to some other tab for reupload...
Example:
Use case: Uploading a picture on dev.to article by downloading any image from some other site

Collapse
 
thisismanaswini profile image
Manaswini

This is one of the most useful articles I've read Gagan!! Wow. So well explained. Good jobπŸ‘

Collapse
 
gagangulyani profile image
Gagan Deep Singh

Thank you so much 😭😭❀️❀️❀️

Collapse
 
ashwinsharmap profile image
Ashwin Sharma P • Edited

Yes, automating things make our life a lot easier. Also, this article was easier to go through as it was filled with memes and simple words.

Collapse
 
gagangulyani profile image
Gagan Deep Singh

Thank you so much, bro! Glad you liked it.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Good post I am still learning Python but this gave me some ideas for future scripts.

Collapse
 
gagangulyani profile image
Gagan Deep Singh

I'm glad you liked it :D

Collapse
 
kadhumalrubaye profile image
kadhum alrubaye

nice post good job

Collapse
 
gagangulyani profile image
Gagan Deep Singh

Thank you πŸ˜„

Collapse
 
swagwik profile image
Sattwik Sahu

Wow!!! That was so EPIC!!!
Python put to some good use here
Thanks soooo much!
Sending love ❀️❀️❀️

Collapse
 
gagangulyani profile image
Gagan Deep Singh

Thank you so much! πŸ˜ƒπŸ˜
I'm glad you liked it.

Collapse
 
mockingloris profile image
Wilfred Macaulay

Great job @Gagan. I liked the way you explained the code lineally! Nice job with the memes too πŸ‘