Python Tutorial - Argparse

Поділитися
Вставка
  • Опубліковано 26 січ 2025

КОМЕНТАРІ • 141

  • @prateekyadav7679
    @prateekyadav7679 2 роки тому +19

    Not only is he teaching python, he is also demonstrating HOW to teach. Great job, bud. Thanks a lot!

  • @IsaacC20
    @IsaacC20 7 років тому +109

    No frills. No distracting music. All content that'll get you up and running with argparse in 4:30 seconds (still understandable if played at x2 speed).
    Thumbs up!

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

      Ngl keyboard was offputting, but besides that amazing

  • @BinnyWinson
    @BinnyWinson 3 дні тому

    Hands down the best explanation on Argparse I've seen... thanks much Johnny... you should do a lot more tutorial video. It would help a lot of people like me who are new to programming...

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

    Best video I've seen today, explains argparse in under 4 minutes! Thank you for the video!

  • @continental_drift
    @continental_drift 5 років тому +15

    I have spent a couple of hours reading the Python documentation and scouring Stackoverflow looking for a simple explanation of the process but they were all way to complicated. Yet this video made the part that I was interested in simply and clear.
    Thank you.

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

    Stupid enough, I made my own parsing module and used it in two of my projects, and then thought of searching for a more efficient way and stumbled upon this video. Thank you very much.

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

    WoW!!!! OMG!!! Best Explanation!!!!!!!! I watched several videos about argparse but non of them could explain like you did. Thank you so much!!!!!

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

    I'm new to python and encounter argparse on one of the programs I was reading. This video clearly explains the use of argparse in a nutshell.

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

    Unreal video mate straight to the point, clear and well explained

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

    Thank you very much. After 8 minutes I understand how and for what I should use argparse.

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

    If every tutorial video were like this, I would be a very happy malchick!

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

    Thank you for getting right to the point and being clear. Thank you for showing the optional arguments feature and explaining your nomenclature. Really good explanation

  • @samre3006
    @samre3006 3 роки тому +6

    I never knew how it worked under the hood. Like does it internally parse the sys.argv... And I resorted to writing my own arg parsers out of laziness, because the documentation looked like -- -- -- for me, now I came across your video and tried it myself in a couple of variations I think I get it now and will start using it like everyone else. It makes sense. Thanks a lot.

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

    I'm five years late to the party but still!!! Thank you for breaking this down for us. Very clear explanation. I wonder why you stopped making videos, you're a great teacher...

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

    Today when I stared reading a friend's code I was completely turned off coz I could not understand many of the components.
    So I did some twitter scrolls and went back to sleep. An hour later I woke up and told myself let me first understand argparse.
    ...now I've learn argparse plus a personal philosophy of "Don't ever try to understand an entire project in one chunk, isolate and understand the challenging parts first" 😂
    I'm still trying hard not to stop at first challenge🙂
    Thanks a lot for the guide, it really helped 👍👍

  • @thetechegg8859
    @thetechegg8859 6 років тому +1

    Most condensed tutorial on this topics yet it was extremely helpful especially when compared to the other ones

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

    Thanks Johnny! This is the best reference I have found for getting the basics and overall gist of argparse module

  • @ardenshackelford7807
    @ardenshackelford7807 6 років тому +1

    This is just what I needed! I was trying to read through someone else's code and this helped me understand what they were doing and how to do it on my own! Thanks!

  • @g38ra
    @g38ra 5 років тому +6

    Beautiful, saved me a lot of time and right to the point. Love it.

  • @nadiiaradionenko8793
    @nadiiaradionenko8793 5 років тому +7

    Very helpful, well-structured, clear - great job! Thank you!

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

    Excellent and easily the best explanation of argparse.

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

    Bro, plz continue to make tutorials. You're way of tutoring is amazing.

  • @anirvansen6591
    @anirvansen6591 5 років тому

    Very well explained , With argparse module,we can build industry level command line programs.Thank you for an excellent explanation.

  • @alinasansevich9182
    @alinasansevich9182 3 роки тому +3

    So well explained! Thank you!
    I've been trying to learn this library on my own but it always seemed a bit confusing, but not anymore, thanks to your tutorial I finally get the basics of it!

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

    Thank you, Johnny! Such a nice, simple description. You helped me a lot :D

  • @DiegoTrapero
    @DiegoTrapero 6 років тому +4

    Great tutorial Johnny! Very concise and to the point. I've managed to make my first cli app with this. Thank you very much :)

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

    Amazing tutorial, I was doing a course where they jumped straight to the code. This helped me understand what was going on.

  • @gaia38ant
    @gaia38ant 5 років тому +1

    a lot clearer than the tutorial on the python doc website, thanks

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

    As with the other commenters, I found this efficient and instructive :). Thank you!

  • @GamingBlake2002
    @GamingBlake2002 7 років тому

    This tutorial made argparse so much easier to understand, great video!

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

    Great tutorial. Argparse may be one of the greatest included libraries in python.

  • @aneeshbhat7328
    @aneeshbhat7328 5 років тому

    Concise and to the point! Found it better than the documentation lol.
    Another useful parameter to parser.add_argument() would be default, which you missed in your video.

  • @Небудьбараном-к1м
    @Небудьбараном-к1м 3 роки тому +1

    GREAT VIDEO! Thank you so much for such a simple and exhaustive explanation!!

  • @BenzSamreeloy
    @BenzSamreeloy 5 років тому

    Really easy to understand and cover necessary ways to use it. Good work mate!

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

    Thanks, you described it quite nicely and slowly for a first learner.

  • @0_-
    @0_- 3 роки тому

    I didn't know this was a thing before. That module is very useful, thanks.

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

    Thanks! very helpful and clear. I wish you showed how to set default values to arguments, too.

  • @guillermoarb
    @guillermoarb 5 років тому

    Thanks it was very clear, now I am up and running with argsparse

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

    bro you saved me so much fuckin time at work with this tutorial, thanks.

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

    Thanks a lot for this tutorial. It helped me so much!!

  • @mikehagerty9666
    @mikehagerty9666 6 років тому +1

    Thanks, that was helpful.
    By default, even though you've indicated that the radius and height arguments are required, the -h help message doesn't indicate this:
    >python arg3.py -h
    usage: arg3.py [-h] -r -H
    Calculate volume of a Cylinder
    optional arguments:
    -h, --help show this help message and exit
    -r , --radius Radius of Cylinder
    -H , --height Height of Cylinder
    However, if you modify it a bit:
    requiredNamed = parser.add_argument_group('required named arguments')
    requiredNamed.add_argument('-r','--radius',type=int,required=True,metavar='',help='Radius of Cylinder')
    requiredNamed.add_argument('-H','--height',type=int,required=True,metavar='',help='Height of Cylinder')
    Then it performs as expected:
    >python arg3.py -h
    usage: arg3.py [-h] -r -H
    Calculate volume of a Cylinder
    optional arguments:
    -h, --help show this help message and exit
    required named arguments:
    -r , --radius Radius of Cylinder
    -H , --height Height of Cylinder
    Thanks again!

  • @alirezagyt
    @alirezagyt 6 років тому +4

    Thanks for explaining 'store_true'!!!

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

    newly started learning python and in one of stackoverflow posts, someone mentioned parse eval method...guess what..now I'm here and freaked out! in middle of learning object oriented programming jumped into such a topic is like shifting 3 gears at once. lol

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

    Right to the point, good work

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

    Exactly what I needed. Thank you for this I love you my dude

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

    you are killing it man... big big like

  • @DheerajAeshdj
    @DheerajAeshdj 5 років тому

    BEST.INTRO.EVER.

  • @edwardwhite8253
    @edwardwhite8253 6 років тому +1

    Hotdamn this video is easy to understand, kudos to you dude

  • @MichalKoziatek
    @MichalKoziatek 5 років тому

    Thanks for this explanation! Very nice. By the way if you use cmd + d it will duplicate the line! Saves some typing

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

    Great presentation. Thanks a lot

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

    Thank you man! Great video.

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

    This was a very helpful video. Thank you so much.

  • @GAUTAMSHARMA-xu7bl
    @GAUTAMSHARMA-xu7bl 5 років тому

    creative way to present it. thanks a lot.

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

    How do i set to display the help by default when no arguments are passed ?

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

    Great Tutorial. Thank You

  • @gautambanuru2266
    @gautambanuru2266 5 років тому

    Super easy to understand. Thanks!

  • @passworduser
    @passworduser 6 років тому +2

    Great tutorial. Thanks!

  • @夕阳-n1h
    @夕阳-n1h 2 роки тому

    Great video, thank a lot!

  • @shripadah
    @shripadah 5 років тому

    Excellent tutorial. Thanks a lot

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

    Well explained!

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

    thank you, it's really clear

  • @aidynabirov7728
    @aidynabirov7728 4 роки тому

    Great explanation!

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

    great video!

  • @teddy_no.1
    @teddy_no.1 5 років тому

    Thank you! Very clear explanation!

  • @MrUlamaca
    @MrUlamaca 6 років тому

    great work. very helpful tutorial

  • @alkhashtee
    @alkhashtee 5 років тому

    Thank you so much. Very good informative video

  • @ir3388
    @ir3388 6 років тому

    Clear explanation. Thank you so much.

  • @hilta7244
    @hilta7244 5 років тому

    Good explanation, thank you so much!

  • @nalloastro6353
    @nalloastro6353 7 років тому +1

    Well prepared. Thank you!!

  • @benkorb6359
    @benkorb6359 8 років тому +1

    Great tutorial!

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

    nice demo

  • @pnachtwey
    @pnachtwey Місяць тому

    How do I make the defaults 1 for radius and height?

    • @JohnnyMetz
      @JohnnyMetz  Місяць тому

      Use the default argument, see docs: docs.python.org/3/library/argparse.html#default

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

    so good 😊

  • @jasonmai1707
    @jasonmai1707 6 років тому +1

    Thanks for the tutorial, Johnny! What application are you using in the video for writing Python scripts?

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

    I am sticking in arguments and my friends recommended it.
    Could help me to how to read variables for functions from a file in argument.
    For example, to execute (python my.py 123.csv parameter par.csv)

  • @Marr575
    @Marr575 5 років тому

    Hi, I got this error:
    alpha_y = float(args.ay)*numpy.pi/180.
    TypeError: float() argument must be a string or a number, not 'NoneType'
    some idea of how to solve it?

    • @JohnnyMetz
      @JohnnyMetz  5 років тому

      Sounds like you're not passing an argument "ay" correctly and it's defaulting to None

  • @SoumilShah
    @SoumilShah 5 років тому

    Great content

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

    amazing bro

  • @lnd59_
    @lnd59_ 7 років тому +2

    Very well. Thanks dude! =D

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

    you are a hero! :)

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

    PERFECT BRO!

  • @codestorywithMIK
    @codestorywithMIK 7 років тому +1

    very helpful. Thanks

  • @alexandergarcia6479
    @alexandergarcia6479 5 років тому

    thank you, it was very helpful.

  • @letrung3249
    @letrung3249 6 років тому

    Great job bro

  • @vedantajha1154
    @vedantajha1154 6 років тому

    Is it possible to give a default value to the variables?

    • @JohnnyMetz
      @JohnnyMetz  6 років тому

      Yes, read about it here: docs.python.org/3/library/argparse.html#default

  • @AmolGautam
    @AmolGautam 5 років тому

    Thanks , for the tutorial.

  • @thelunes6549
    @thelunes6549 6 років тому

    This was a really well done video. I did have one question though: could you (or anyone else who would like to chime in) explain what the metavar=' ' does in more detail?

    • @JohnnyMetz
      @JohnnyMetz  6 років тому +1

      docs.python.org/3/library/argparse.html#metavar

    • @thelunes6549
      @thelunes6549 6 років тому

      That's perfect, thank you.

  • @w.schobel1514
    @w.schobel1514 7 років тому

    very clear. thumbs up

  • @Shinykip
    @Shinykip 8 років тому +1

    Nice job. Thanks.

  • @philipperichard5756
    @philipperichard5756 6 років тому

    Thanks for your help!

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

    usage: 3.py [-h] radius height
    3.py: error: the following arguments are required: radius, height
    I'm getting this error.
    can you please help me.

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

      You need to pass in a number for the radius and the height: "python 3.py 2 4"
      In the example above, the radius is 2 and the height is 4. I'm assuming your file name is "3.py", if not just change it.

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

      @@JohnnyMetz Thank you

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

    thanks, it was great

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

    This was so good

  • @vjp2866
    @vjp2866 5 років тому

    Nice tutorial

  • @AssadNiang
    @AssadNiang 5 років тому

    Thank you
    Great tutorial

  • @boughellabamouaad8313
    @boughellabamouaad8313 7 років тому +1

    Thank you for that tutorial

  • @HG-mt3vl
    @HG-mt3vl 6 років тому

    Great video, thanks

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

    Thank you so much~!

  • @juillotine
    @juillotine 4 роки тому

    Thanks Johnny