Python Tutorial: Pathlib - The Modern Way to Handle File Paths

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 79

  • @coreyms
    @coreyms  Місяць тому +14

    Clarification around 6:42… The str() representation of the Pathlib object and the output of the name method are only the same in that specific example because that file and directory live within the top level of the current working directory. These outputs aren't always the same, such as when a file is another level deep. That would cause the str() representation to print out that entire relative path where the name would still just be the file name. You can see this in action at 9:18.
    Thanks to Ekster for sponsoring this video! Be sure to use code "SCHAFER" at checkout:
    partner.ekster.com/coreyms

  • @felicytatomaszewska
    @felicytatomaszewska Місяць тому +44

    Watching this video brings back memories of my high school days when I learned Python by watching the valuable videos created by Mr. MS Corey, who has been like a teacher to me, even though we never met. I have been using Pathlib for some time now and find it to be a cleaner and better way of handling paths. I watched this tutorial purely for nostalgic reasons. Thank you very much, Mr. MS Corey; you are an amazing teacher.

    • @rancoxu
      @rancoxu Місяць тому +2

      me too!

  • @difegam3
    @difegam3 21 день тому +1

    My native language is Spanish, and your videos were some of the first I started watching in English. They were so well explained that I didn’t need to understand every word to grasp the ideas. I initially used your videos as supplements for things I needed to learn for my studies, but I continued watching because they are truly an excellent source of information. Now I work as a Python developer, and I’m glad to see new videos on your channel again. Even though I’m already using this library, I’ll watch the video because I’m sure I’ll get something positive out of it. Thank you, and welcome back!🎉💪🏽

  • @olgierd245
    @olgierd245 Місяць тому +1

    Please do not be bothered by lower views or anything, UA-cam does it's weird own thing. Back in the day, 5 years ago or so I was reading people's stories on this channel how they got their job with your well laid out fundamentals and now I'm literally one these lucky people. And I got the job when I struggled the most and without all the understanding that came with these videos I am not sure it would have reached that point. Especially that I was put in the job market without collage degree (which I'm doing now, cuz I can afford it more easily)
    Thank you so much, I will watch all of the new videos soon, cuz I'm interested, but you're doing something incredible for every single one of us.
    Hope you're doing great. It's good to see you back!

  • @ag49521
    @ag49521 Місяць тому +6

    After years, still my favorite Python tutorials channel!

  • @ibcomputing
    @ibcomputing Місяць тому +1

    Welcome back. please consider fastapi tutorial series

  • @JithinJKumar
    @JithinJKumar Місяць тому +7

    Welcome back corey.. Im now a python developer because of you...

  • @androidynamit
    @androidynamit Місяць тому +1

    Hey corey, you may hear this often but you're the reason why I can code in python, like truly your python playlist I've done it all and it's the best python tutorial playlist in youtube, love your work man! God bless🙏🏻

  • @govarthenanrajadurai9817
    @govarthenanrajadurai9817 Місяць тому +1

    Love to see you back. Big fan 🫡

  • @diptendupal6028
    @diptendupal6028 Місяць тому +1

    It was such a crisp and detailed video to the point im a lazy guy and don't comment much but man the simplicity in your teaching is just another level keep up the good work and btw please upload the shutil module tutorial

  • @nicop175
    @nicop175 Місяць тому +13

    I see a Corey video y press like! No matter what. Love to see you back Corey! Hope you are ok and finally solved all your issues!

  • @cary6652
    @cary6652 Місяць тому +2

    I used this from time to time, but then always forget how much better it is. This was a great example of why you should move over to pathlib. Thank you! Time to rewrite all my scripts!

  • @coldy5845
    @coldy5845 Місяць тому +1

    Hi Corey, thank you for the new series.. you are great teacher and i am glad that you are back with some new content. Since you teach things very clearly, i would like to request videos on technologies like docker, jenkins, pipelines etc. I think those are very common these days and I would like to learn them from you. Thanks again for everything you've taught us throughout the years.

  • @NoahElRhandour
    @NoahElRhandour Місяць тому +4

    Glad, one of my favorite teachers of all time is back!

  • @abdulmuminakinde3117
    @abdulmuminakinde3117 Місяць тому +12

    I'm a simple man. when I see a Corey Schafer video, I like and watch. In that order.

  • @s.baskaravishnu22
    @s.baskaravishnu22 24 дні тому +1

    Many thanks

  • @obeliskphaeton
    @obeliskphaeton Місяць тому +17

    The return of the king 👑

  • @NipkowDisk
    @NipkowDisk Місяць тому +6

    Always a good day when I see a new video from Corey Schafer. Thank you!!

  • @JT-qi4xx
    @JT-qi4xx Місяць тому +2

    Oh man, you are back! I missed you, buddy! Glad to see more content and most importantly glad to see you back :) Much love from UK

  • @ipelezikis
    @ipelezikis Місяць тому +2

    Nice to see you back! You ve helped lots of people! ❤

  • @kapibara2440
    @kapibara2440 Місяць тому +1

    Thank you Corey! Bedt of luck to you🎉

  • @chiroyce
    @chiroyce Місяць тому +3

    Ahh good ol' memories of learning Python from Corey, warms my heart to see that you're still making one of the best Python tutorials ever.... once again thanks for everything you've done! :)

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

    Good to see you back bro. I started watching your tutorials shortly before Covid began and I have learned python, pandas, git from you (and others). Now I use these knowledge in my daily work as a data analyst. I view you as a good mentor even though we have never met. Thank you.

  • @thetruereality2
    @thetruereality2 Місяць тому +6

    Thanks

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

    OG of python devs is back...
    Great to listen to you again.

  • @volbla
    @volbla Місяць тому +2

    It's also fairly easy to modify Paths with the .with_name(), .with_stem() and .with_suffix() methods.

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

      Great point! There’s definitely some additional useful things to do with it that weren’t touched on in the vid

  • @markslima1557
    @markslima1557 Місяць тому +2

    thank you so much for this excellent video and again, great to have you on here again with modern python tutorials!

  • @wKaransingh
    @wKaransingh Місяць тому +1

    Corey cooked another one!

  • @dgbene1
    @dgbene1 Місяць тому +1

    Took me a little while to get into. It’s so much easier than using os.

  • @bismarkasirifiantwi7231
    @bismarkasirifiantwi7231 Місяць тому +2

    Continue your good work, Mr.Corey🥰😂😀👍

  • @McDonaldIbekwe
    @McDonaldIbekwe Місяць тому +1

    Welcome back. Nice video

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

    Great video and we are waiting for tkinter part three

  • @prashlovessamosa
    @prashlovessamosa Місяць тому +1

    Please upload frequently.

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

    Legend is Back ❤

  • @yuanye710
    @yuanye710 Місяць тому +1

    Thank you! Also just wondering if you have plans for PySpark?

  • @darklucifer2853
    @darklucifer2853 Місяць тому +1

    Sir i know you are busy with your work and life but its humble request please do consider to make a series on python , updated version
    sharing you indepth knowledge of the concept , main aim is if one is to learn python than on which concepts he should focus on the base (foundations) to make way for a brilliant career like yours in python . A humble request sir do consider thanks

  • @WhalesLoveSmash
    @WhalesLoveSmash 7 днів тому

    We need more videos!

  • @faghihy
    @faghihy Місяць тому +1

    Thanks for you really understandable trainings. But... you promised about pytest course! Where is it?

  • @mdsegara101
    @mdsegara101 Місяць тому +2

    it's because os module is working with string that i'm still using os module, since i'm doing a lot of path modification script, with string is really easy to do it, and also couldn't move on from os.walk() that being easily to access and modifying all directories, subd, and files within a single loop.

    • @coreyms
      @coreyms  Місяць тому +3

      I’d be interested to see what you’re doing exactly and what the pathlib equivalent looks like. Could be a cool little exercise to show the differences.

  • @Manas_nannvatte
    @Manas_nannvatte Місяць тому +1

    Please do tutorial on polars

  • @marswind285
    @marswind285 Місяць тому +1

    I work in a conservative field of engineering - aerospace. Switching from os to pathlib was a great Step forward. But: one function is misleading: relative path. As we produce tons of internal HTML files, it is an essential requirement.
    I found no clean pl solution, therefore I continue using the os implementation. Otherwise: great lib.

  • @SankarGentlemen
    @SankarGentlemen 24 дні тому +1

    is there any videos related to DSA using python in this playlist

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

    Hey Corey, I'm a massive fan!
    I see pyspark as a required skill for so many data engineering jobs. Do you have a video on it? If not what are your thoughts on making one?
    You're the best!

  • @junpyohong2132
    @junpyohong2132 Місяць тому +1

    I've been really enjoying using pathlib.Path because it provides intuitive operators and methods.
    Thank you very much for the comprehensive and well described explanation of this module.

  • @AnkitTiwari-dq7qm
    @AnkitTiwari-dq7qm Місяць тому +1

    Thanks for the video sir, most of the time I found confusing between windows path and posix path while working on cross platform code how do we can use a common path which can work on both OS eg. If I want to get a file from windows I've to specify `\` and for linux `/` is there universal way to do this using pathlib?

  • @stalinengoma7680
    @stalinengoma7680 Місяць тому +1

    I've never really worked with the os module since my recent introduction to Python. I used the Pathlib module and really enjoyed it for automating my file management tasks and I discovered many more features of it from this video. I definitely don’t have to regret although I have to learn a bit on the other one you proposed

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

    Please continue the GUI course.

  • @NoraSundman
    @NoraSundman Місяць тому +1

    Hi Corey. Are you related to Hunter Schafer?

  • @boyrok100
    @boyrok100 Місяць тому +1

    python and htmx tutorial pls

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

    When you start doing your web development series, could you consider doing a tutorial on FastAPI and HTMX?

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

      I’ve already started the writing process but a series of tutorials takes a long time for me to put together. I’ll have a better idea in the next couple of weeks how close I am. And yes, I do plan to include FastAPI

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

      @@coreyms that's fantastic... your videos are really good quality... so it will be worth the wait...

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

    dataclasses next please

  • @sj24560
    @sj24560 Місяць тому +1

    Your videos are so useful! Could you structure your Python playlist to show what to learn first, second, and so on? That would be helpful for beginners.

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

    🎉🎉🎉

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

    The goat is back

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

    thank you!

  • @EircWong
    @EircWong Місяць тому +3

    Sir, I like your Python courses, but they are a little old, are you going to record a new Python course?

    • @coreyms
      @coreyms  Місяць тому +7

      I plan to, yes. But it will be after I rerelease my personal website and put out the tutorials on that whole process

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

      @@coreyms great!! can't wait!!

  • @Esistomer
    @Esistomer Місяць тому +1

    hi sir, can i make thumbnails for u? :)

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

    We miss you, I hope you are great

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

    Please, Make one video for jobs belongs to python and it's libraries

  • @chobblegobbler6671
    @chobblegobbler6671 Місяць тому +3

    Fast api and async my man

    • @coreyms
      @coreyms  Місяць тому +7

      They’re getting there! Been workin on em for a bit

    • @unesmk3811
      @unesmk3811 Місяць тому +1

      ​@@coreyms saving our lives, thank you so much corey

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

    and then we are getting "the parent of that and then the parent of that" that is a clunky solution.

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

      The Pathlib example is clunky? Why’s that? How else would you go 2 directories up? That’s not my code, that’s Django’s core code.

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

      @@coreyms to be a relevant development the paths folder needs to become a first-level folder, this fact would simplify everything.

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

    The reality is: if you're rich and famous, your luxrul bags are seen as a sign of success. If you are just an ordinary worker working a 9-to-5 job, your real bag is likely to be considered the fruit of your efforts.

  • @Dara-lj8rk
    @Dara-lj8rk Місяць тому +1

    thanks