Argparse Basics - How I run my scripts via the Command Line
Вставка
- Опубліковано 11 жов 2024
- Argparse lets you pass in user defined arguments to you code before it runs, this is a great way to change specific parts without editing your code or taking in user input. This video covers the very basics, and is aimed at someone who has never used argparse before - there's a lot more to it than just this but I hope that this will give you a good idea of what you can achieve with it and maybe make your life a little easier when running your repeatable web scrapers.
------------------------------------
Disclaimer: These are affiliate links and as an Amazon Associate I earn from qualifying purchases
-------------------------------------
Digital Ocean (Cloud Servers, Affiliate Link) - m.do.co/c/c7c9...
Sound like me:
microphone amzn.to/36TbaAW
mic arm amzn.to/33NJI5v
audio interface amzn.to/2FlnfU0
-------------------------------------
Video like me:
webcam amzn.to/2SJHopS
camera amzn.to/3iVIJol
studio lights amzn.to/3aBpKik
small lights amzn.to/2GN7INg
-------------------------------------
This is the type of guide I need. Quick, easy, only the essentials.
Also a very straight forward easy example without much around it. Thx!
Nice! I've often wondered how to do this, and have hacked my way through Linux shell scripts to get around it.
Sidenote: I'm taking a data science course now, and all of your scraper tutorials have been a HUGE help in gathering initial data sets. Once again, much appreciated.
That's great! Glad I've helped Matt
Amazing video! Thank you so much for posting. Like others, I spent a ton of time reading confusing documentation before finding this video which is the absolute best explanation available!
Thank you!
God I searched the entire day for a vid like this. Thank you!!!
Thanks glad it was useful for you!
Thank you! This helped me out so much. I was stuck and couldn't get my script to work. But this helped out a lot!
This is a easy to understand lesson on how to use argparse to store the commandline user input and parse it into the python script!
I follow you from Egypt and I would like to tell you that your content is really useful
Awesome, thank you!
@@JohnWatsonRooney
Keep being creative
Hello Mate,
I just discovered you recently.
Your content is FUCKING AMAZING!
Easy to understand for begginers.
Wish you all the best!!
Hey man don't know if you remember me, learnt a lot from your scrapy and again you're saving my life here. THANKS!
Thanks very kind!
Love the video, but would love it more with a Liverpool example
Just what i was looking for, thank you.
Glad I could help!
good vid. For your next vid, can you make a vid about a more advanced application of agparse? and please upload to pastebin or something so we can play around it with it.
Amazing and awesome my tutor.
Thanks for making this video :)
I have a question: when it comes to scraping the page on which the data is updated every, say, 5 minutes , then python scrypt based on the libraries like: requests ,bs, pandas would be enough to deal with it and write down an incoming data into dataframe or it will require some scrypt to manage when to activate the scraping code on the page ?
Is it possible to execute the script with the arguments and also just in the normal way, like before adding argparse? How can I make the script function with both options?
Very clear! Thank you :)
concise video- awesome.
Thanks.
I finally found it thanks alot
Using argparse Is it possible to select the argument from the displayed list? So py file has to run first and then argument passed later!
Afraid not it only works by passing in arguments at the beginning, like a cli tool
Amazing 👏👏
what's the difference with the sys.argv ?
Way great content keep it up!🙏
Great video! Also, what theme is that?
Awesome thank you :)
Thanks glad you enjoyed it
What is metavar?
what do we think of Tottenham?
s***!
Thanks
r = memory - Raam! Ancient Native AMrr.
700th like!
Can't get over the typo "statiums"
Too many typos for such a short video, disliked.
You look like Emminem
I wasted a lot of time with argparse before I found click. Then a lot more rewriting...
i have this problem
parser = argparse.ArgumentParser(description="find image")
parser.add_argument('img',metavar='img',type=str,help='enter your image')
parser.add_argument('output',metavar='output', type=str,help="output")
parser.add_argument("500",metavar=500, type=int,help="enter your w ")
parser.add_argument("500",metavar=500, type=int,help='enter your h')
args = parser.parse_args()