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
    -------------------------------------

КОМЕНТАРІ • 47

  • @SirVampyr
    @SirVampyr 8 місяців тому +3

    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!

  • @mattmovesmountains1443
    @mattmovesmountains1443 3 роки тому +8

    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.

  • @Shaush10
    @Shaush10 2 роки тому +2

    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!

  • @getoutmore
    @getoutmore 2 роки тому +2

    God I searched the entire day for a vid like this. Thank you!!!

  • @evanslawrence88
    @evanslawrence88 6 місяців тому +1

    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!

  • @timpanister73
    @timpanister73 3 роки тому +5

    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!

  • @statement-01
    @statement-01 Рік тому +1

    I follow you from Egypt and I would like to tell you that your content is really useful

  • @fr-tiktok-compilations-2023
    @fr-tiktok-compilations-2023 2 роки тому +1

    Hello Mate,
    I just discovered you recently.
    Your content is FUCKING AMAZING!
    Easy to understand for begginers.
    Wish you all the best!!

  • @GelsYT
    @GelsYT 2 роки тому +1

    Hey man don't know if you remember me, learnt a lot from your scrapy and again you're saving my life here. THANKS!

  • @jimshapedcoding
    @jimshapedcoding 5 місяців тому

    Love the video, but would love it more with a Liverpool example

  • @_indrid_cold_
    @_indrid_cold_ 3 роки тому +1

    Just what i was looking for, thank you.

  • @undertoes
    @undertoes 3 роки тому +1

    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.

  • @KhalilYasser
    @KhalilYasser 3 роки тому +2

    Amazing and awesome my tutor.

  • @sughosh100
    @sughosh100 Рік тому +1

    Thanks for making this video :)

  • @maciekpaciarski9343
    @maciekpaciarski9343 3 роки тому +1

    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 ?

  • @chiara3182
    @chiara3182 7 місяців тому

    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?

  • @samadhichandrasena8768
    @samadhichandrasena8768 Рік тому +1

    Very clear! Thank you :)

  • @LITHIUMINWATER
    @LITHIUMINWATER 2 роки тому +1

    concise video- awesome.
    Thanks.

  • @hidden_network
    @hidden_network Рік тому +1

    I finally found it thanks alot

  • @sivaranjjan2491
    @sivaranjjan2491 Рік тому +1

    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!

    • @JohnWatsonRooney
      @JohnWatsonRooney  Рік тому

      Afraid not it only works by passing in arguments at the beginning, like a cli tool

  • @RamMohan-xu3ey
    @RamMohan-xu3ey 3 роки тому +2

    Amazing 👏👏

  • @novianindy887
    @novianindy887 2 роки тому +1

    what's the difference with the sys.argv ?

  • @leonine6926
    @leonine6926 3 роки тому

    Way great content keep it up!🙏

  • @alejocv7
    @alejocv7 2 роки тому

    Great video! Also, what theme is that?

  • @djbroake9810
    @djbroake9810 Рік тому +1

    Awesome thank you :)

  • @marklandgraf7667
    @marklandgraf7667 Рік тому

    What is metavar?

  • @cristerronaldosuwy7171
    @cristerronaldosuwy7171 9 місяців тому

    what do we think of Tottenham?

  • @מאירכהן-ח3צ
    @מאירכהן-ח3צ 4 місяці тому

    Thanks

  • @paulhetherington3854
    @paulhetherington3854 2 роки тому

    r = memory - Raam! Ancient Native AMrr.

  • @azuretech-extra
    @azuretech-extra Рік тому +1

    700th like!

  • @MccZerk
    @MccZerk Рік тому

    Can't get over the typo "statiums"

    • @MccZerk
      @MccZerk Рік тому +1

      Too many typos for such a short video, disliked.

  • @jibinvarghese3066
    @jibinvarghese3066 2 роки тому

    You look like Emminem

  • @nathantoulbert4406
    @nathantoulbert4406 2 роки тому

    I wasted a lot of time with argparse before I found click. Then a lot more rewriting...

  • @الماكينةالذكية
    @الماكينةالذكية 7 місяців тому

    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()