Python Tutorial 14: Saving and Reading Data Files With Pickle

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ธ.ค. 2024

ความคิดเห็น • 150

  • @yehiaayoub4041
    @yehiaayoub4041 3 ปีที่แล้ว +15

    I started learning programming eight months ago since I started studying to be an engineer, before then i knew nothing about programming whatsoever and it's one my drawbacks.
    I was worried it would be too hard to learn, but your videos help me A LOT, and I'm currently watching the Arduino tutorials.
    Learning a lot from you, thank you so much

  • @patfacunla1687
    @patfacunla1687 3 ปีที่แล้ว +1

    Boom!!! I can't believe it I am legend! All thanks to our great teacher Paul McWhorter!

  • @soundarrajankannan7692
    @soundarrajankannan7692 3 ปีที่แล้ว +1

    I am Legend. I just written down the Homework you said as steps like
    program one:
    1. ask how many student you have?
    2.Then ask for: student name and his average
    3. Then pickle the data
    program two:
    1.Ask which student are you interested in?
    2.Get data from pickle file
    3.Then show up his grade
    Really writing things to do helps a lot. Again, Thanks a lot. Great teaching. I am getting addicted to your videos.

  • @martinjones1390
    @martinjones1390 ปีที่แล้ว +1

    I am legend! Discovered your set of Python tutorials yesterday and I'm already up to lesson 14. I started commercial programming in COBOL in 1975, a very different world. Any current sbc could eat those 'mainframe' monsters for breakfast in terms of processing power, memory and storage. Amazes me what we could do on a computer with 256KB memory and 240MB of hard disk. Many platforms and programming languages / environments since. I'll be buying the Arduino kit soon and will be looking at your Arduino tutorials even though the pure electronics side of it will be a mystery to me. Haven't looked at electrical theory since senior high school days, (but I did win the senior physics prize for that year so there's some hope for me yet!).

  • @miken2664
    @miken2664 3 ปีที่แล้ว +2

    "We are going to dump nuts" made me have to pause the video 😂. I'm just glad I didn't disrupt the rest of the class. Top lessons as always. Thanks Paul

  • @diessos
    @diessos 2 ปีที่แล้ว

    I am legend.... (and I am John Galt!). I've been programming for 45 years, and this is my first exposure to Python. I've also worked through your Arduino courses. Using that class, I'm replacing a blown stepper motor controller on a older telescope with a Nano. Very cool stuff.

  • @davidschnider1297
    @davidschnider1297 ปีที่แล้ว

    Hi Paul... another excellent lesson.... I didn't do the homework... sorry... but.. I DID apply what I learned here to debug my headless GPS project by pickling the data and saving it to the SD Card .. .and then writing another little program to READ and display the data after a test drive . This helped me "see" what my GPS program was reading and processing... and I was then able to debug and complete the project. I have decided to head on back to the RPi 4 projects / lessons.... ( for now ) ... Thanks again, Paul... God bless you, Brother.

  • @opalprestonshirley1700
    @opalprestonshirley1700 3 ปีที่แล้ว +1

    Enjoyed the lesson. I had not known of Pickle, been using the open, 'w', 'r' and close. This simplifies the work. I hate that about your arrest, especially since it was the previous owner who had those but at least that's behind you. Stay safe and enjoy whatever comes your way.

  • @vladmelnic-
    @vladmelnic- 3 ปีที่แล้ว +1

    Mandatory legend. To give myself a bit of freedom with student data, I created a student class. For writing and reading I used json. I had to convert the classes to dicts when writing, but luckily you can just apply var() to them before adding to the array. It was a bit of pain to find the var() solution, but that was actually the hardest part!
    Love the lessons. Keep up the great work!

  • @pateekdarnal2256
    @pateekdarnal2256 3 ปีที่แล้ว +1

    Thankyou sir for your lesson, I am proud of myself I solved pickle homework and this was the first ever homework i solved on my own. Thankyou sir I AM LEGEND may god bless you.

  • @Pikuto
    @Pikuto 3 ปีที่แล้ว +14

    When there will be new Arduino lessons? , or video(s): like - "How to built drone on Arduino"?. Thanks for your lessons. Thanks for teaching us programming languages. My future work= Programmer.

  • @robinedminson6461
    @robinedminson6461 2 ปีที่แล้ว +2

    Hey Paul. I'm really enjoying this series. I am in awe of your teaching style and have learnt a lot form your excellent skills. I previously worked through quite a bit of your Arduino classes. Now looking into Python and slowly getting there. Just completed the homework for this session. Had all the right ideas but lacking in the syntax memory department!
    Looking through my previous work helps. Even discovered how to embed a variable in an input function 🙂
    I'll follow this series through to it's conclusion. Thanks for all you do

  • @hughpatterson1480
    @hughpatterson1480 2 ปีที่แล้ว

    pickle is something my students really need to embrace so they'll be watching your fantastic lesson. Thanks Paul!

  • @johnplowright6421
    @johnplowright6421 3 ปีที่แล้ว

    To coin your phrase: BOOM I am Legend. Very enjoyable lesson and Homework, had to review this video a few times to get the syntax right but got it working using a counter in my while loop for the number of entries instead of asking how many they want to enter.

  • @vinayb5076
    @vinayb5076 3 ปีที่แล้ว +3

    Sir we are so excited to listen your lessons I'm in class 12 a bio student but I learnt Arduino tutorials now I'm sticking to learn python. Thank you so much sir

  • @qneal78710
    @qneal78710 2 ปีที่แล้ว

    I have enjoyed your lesson and thankful that I came across it. I have been using a python book but came across a section where they don't explain it too well, so I went online and I found you. Thanks for giving clear instructions. I will start looking at your tutorials and also donating money

  • @airwavested
    @airwavested 3 ปีที่แล้ว +2

    Another Most Excellent lesson!

  • @scouscoustm
    @scouscoustm 2 ปีที่แล้ว

    I am legend! Took a short while to figure it out but thanks to your most excellent teaching of past topics it turned out to be easier than I thought!

  • @jabber2824
    @jabber2824 5 หลายเดือนก่อน

    I am legend. I had to go back to lesson 3 to figure out how to address an 2-dimensional array. Very interesting lesson.

  • @Tivis7
    @Tivis7 2 ปีที่แล้ว

    Took me around 5 hours and some back and forth with a fellow classmate, but we finally figured out a couple ways of doing it!!! The way I did it was by saving all the info in separate arrays then bunching up that info into a single array which was then pickled. That way I could say how many grades there were, the names, and the grades. After that, on the second program I just used a for loop to match the user's input to one of the names.

  • @andylaurie326
    @andylaurie326 3 ปีที่แล้ว

    I finally got it. Used all the stuff taught plus my brain to get it done. I learned a lot. Thank very much.

  • @walkingtorch
    @walkingtorch 3 ปีที่แล้ว +1

    Ayyyyyyy it’s the man that taught me how to program an arduino uno r3

  • @benhurley7565
    @benhurley7565 3 ปีที่แล้ว

    I am legend! I finally got around to having a go at one of the homework assignments instead of just watching and learned a lot. Thanks.

  • @sarahz2255
    @sarahz2255 2 ปีที่แล้ว

    Love your explanation,easy to understand for beginner.

  • @michaelwise4040
    @michaelwise4040 2 ปีที่แล้ว

    I AM LEGEND! Thank you so much Paul for these incredible videos. I am currently doing an engineering apprenticeship and hoping that learning Python will set me up for new languages and a wider career plan in the future! You are the real legend here!!

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว

      Fantastic! Also if you have not already watch my series on how to be a successful engineer, will cover every thing you need to know to land that dream job.

    • @michaelwise4040
      @michaelwise4040 2 ปีที่แล้ว

      @@paulmcwhorter I will start to watch them today, looking forward to learning more skills and gaining knowledge!

  • @colepdx187
    @colepdx187 2 ปีที่แล้ว

    Python is amazing. The more I delve into the online docs to get the HW assignments done, the more I discover how powerful this programming language is. I'm really looking forward to the next series about using Python with Arduino even though I no longer have the room for my workbench and had to pack my micro-controller lab away into boxes, I'll find a way to setup a small work area somewhere. Thanks for the tutorials. I'll head over to Patreon and do what I can.
    Here is a streamlined version of the bubble sort from the last assignment using one of the powerful features of the language (note the swap):
    i=0
    while (i < numGrades - 1):
    if(grades[i] < grades[i + 1]):
    grades[i], grades[i + 1] = grades[i + 1], grades[i]
    i += 1 * (i == 0) + -1 * (i > 0)
    else:
    i += 1

  • @opalprestonshirley1700
    @opalprestonshirley1700 3 ปีที่แล้ว

    Got her working both programs. It was a bit of a challenge but really enjoyed these two programs. Let's keep having fun.

    • @paulmcwhorter
      @paulmcwhorter  3 ปีที่แล้ว

      Great to hear! Thanks for the comment, Opal

  • @darthdaenerys
    @darthdaenerys 3 ปีที่แล้ว +2

    Thanks paul, I'm a legend. All bcoz of you

  • @ulrichvantonder6719
    @ulrichvantonder6719 2 ปีที่แล้ว

    I AM LEGEND, Thanks for the great tutorials, it is by far the best I have ever done!

  • @bharathr110
    @bharathr110 3 ปีที่แล้ว +1

    I am Legend! Your lessons are very easy to understand. Thank you.

  • @ottawakravmagaacademy7013
    @ottawakravmagaacademy7013 3 ปีที่แล้ว

    I AM LEGEND!!!, this was really a fun lesson. I did my homework on my own. I'm used to working with datasets so this was pretty simple for me to map out my file. Thank you for showing this and I look forward to seeing your solution next week.

  • @spoof3974
    @spoof3974 3 ปีที่แล้ว

    I AM LEGEND! So proud of myself because I was having a problems because of one misplaced parentheses.

  • @georgineshkov6479
    @georgineshkov6479 3 ปีที่แล้ว

    I am legend! Even made the second module to validate the entered name and if it's not existent or mistyped - reports that "No student with this name has been found!" Ah...something comes to mind with this lesson: I hope in some late lesson we get to explore what these 'wb' and 'rb' strings meaning is. Anyway - great lessons, kuddos to you Paul!

    • @harshjee4134
      @harshjee4134 3 ปีที่แล้ว

      Hello georgi, i tried the same, but when i type the non-existing name, it reports 'error... student not found' 8 times (No. of students are 8), maybe it's because of for loop, or idk, can you tell me how to fix that, thanks.

  • @boydrogers7227
    @boydrogers7227 3 ปีที่แล้ว +8

    We regret to inform you that there is no room available for folding lawn furniture as the designated space is currently filled to capacity with LEGEND!

  • @MrElFRanz
    @MrElFRanz 3 ปีที่แล้ว

    Dear Paul, thanks to your lesosns, I could do this homework. Kind greetings.

  • @codecage9333
    @codecage9333 3 ปีที่แล้ว

    I am legend! Once I finished it became quite obvious how simple it actually was to accomplish.

  • @larryplatzek9017
    @larryplatzek9017 3 ปีที่แล้ว +1

    We are ready for more learning!

  • @abdullahchoudhury3080
    @abdullahchoudhury3080 3 ปีที่แล้ว +1

    I AM LEGEND! Thank you Paul. When you finish your VPython series and OpenCV series, could you please do some lessons on C++. Thank you again for these great lessons.

  • @flhTK-2012
    @flhTK-2012 2 ปีที่แล้ว

    Pretty neat app Pickle. We'll see after new years how easy the homework is.

  • @makergc3d
    @makergc3d ปีที่แล้ว

    Apparently you're a Legend of an instructor because I Am Legend ... at least for this lession!😉 Completed assignment less than 9- minutes.

  • @mohsenr4434
    @mohsenr4434 2 ปีที่แล้ว

    Great tips.. Thank you very much!

  • @atesotheater6536
    @atesotheater6536 3 ปีที่แล้ว +1

    thank you soo much for the lesson,
    still waiting for more Arduino tutorials
    more love from martin UG

  • @advancedperformance9721
    @advancedperformance9721 3 ปีที่แล้ว +1

    Thanks alot sir love it alot

  • @amayaphotos8016
    @amayaphotos8016 ปีที่แล้ว

    Another Interesting Lesson

  • @keithneal7927
    @keithneal7927 10 หลายเดือนก่อน

    I'm legend, really enjoying the course

  • @LorenBurdette
    @LorenBurdette ปีที่แล้ว

    Legend. Great lesson.

  • @damsaddles9911
    @damsaddles9911 3 ปีที่แล้ว

    yes sir, I am a legend, thanks to you

  • @Hyfh2
    @Hyfh2 2 ปีที่แล้ว

    thank you for your lesson

  • @MrXshadow1
    @MrXshadow1 ปีที่แล้ว

    Paul i love u sm sir from morocco ❤️

  • @pralaymajumdar1206
    @pralaymajumdar1206 3 ปีที่แล้ว

    Learn a lot from you. Thank u sir.

  • @ricardobjorkeheim775
    @ricardobjorkeheim775 3 ปีที่แล้ว

    Another Most Excellent lesson! :)

  • @blasterTC
    @blasterTC 3 ปีที่แล้ว +1

    A question, could you teach open() and close() commands in python as well, for use with basic notepad files?
    I went a bit ahead with self learning and made an automated high-score table with them, but took me way too long and i'm wondering if there is a simpler way of doing it without libraries.

  • @taurus548
    @taurus548 3 ปีที่แล้ว +1

    Sorry Paul but in your open(....) lines you introduce the term "wb" and "rb", which I understand stands for; write binary and read binary. Maybe I missed where you told us where they come from. Are they standard terms used in Python and do not need any definition. Could you expand on them a little?
    Similarly the "dt" in line 12 "for dt in bigKahuna:" where was "dt" defined??
    Many Thanks, I am enjoying the course.

    • @bigbogeyface
      @bigbogeyface 3 ปีที่แล้ว

      I believe "wb" and "rb" to be standard in python.
      As for "dt" in bigKahuna 🤔
      It appears to be an empty variable.
      It must update itself with each element of the bigKahuna array, while simultaneously counting which index of the array it is on, (as it continues only for the number of elements in the array).
      I'm guessing this is a pre-existing feature of variables, in for loops, in python.
      Good stuff though hey 👍 😃

    • @刘振波-h8t
      @刘振波-h8t ปีที่แล้ว

      @@bigbogeyface great

  • @chernoblyat1901
    @chernoblyat1901 3 ปีที่แล้ว +1

    Serious question: Is it possible to get a job like programing or robotics if your source of education is through TH-cam and the internet?

    • @paulmcwhorter
      @paulmcwhorter  3 ปีที่แล้ว

      Go into the interview with a heck of a project you have built. Something that shows you can do hardware and software. Show them what you can do and you have a shot.

  • @handofash
    @handofash 3 ปีที่แล้ว

    I'm back after a summer hiatus in the mountains. Don't worry, I kept the Patreon flowing.

    • @paulmcwhorter
      @paulmcwhorter  3 ปีที่แล้ว

      Thanks! Really appreciate the help on Patreon.

  • @architjain1908
    @architjain1908 3 ปีที่แล้ว

    I am a LEGEND!

  • @MrTrollHobbit
    @MrTrollHobbit 7 หลายเดือนก่อน

    On my 14th cup of coffee, no sugar, no sweetener today and I am about to program God in Python

  • @dzeykop
    @dzeykop ปีที่แล้ว

    Thank you Sir, another great lesson! Your lessons are not wasted time (#NWT) for me and that is exactly what I want! 👍

  • @rt5hrnbfa304
    @rt5hrnbfa304 3 ปีที่แล้ว

    Hello Paul, a bit unrelated but how'd the hydroponically-grown plants fared since you first showed us your greenhouse in 2019?

  • @kme8134
    @kme8134 2 ปีที่แล้ว

    I got it :) thank you boss!

  • @alexthebear
    @alexthebear 3 ปีที่แล้ว

    Thanks. The intro where you talked a little bit slower - was the best. Now it is a little bit fast.
    Because this intro is essential for all videos. I adore this phrase about coffee and jet fighters)

  • @RobVollmar
    @RobVollmar 3 ปีที่แล้ว

    I, sir, am legend.

  • @KamaldeenAdam
    @KamaldeenAdam ปีที่แล้ว

    please sir, I didn't understood what you meant by the wright binary(wb) and the other. please help me with that or anyone can help as well.

  • @aman-sood
    @aman-sood 2 ปีที่แล้ว

    Watched this since the AI lesson 17's homework requires writing data to the disk and I have not watched the python series :P!

  • @kekekeernest8920
    @kekekeernest8920 3 ปีที่แล้ว

    Greetings to you Sir Paul, when are looking forward for our next lesson on "Robotics" , and we also need a new lesson on Raspberry pi

  • @Doakley_42
    @Doakley_42 3 ปีที่แล้ว

    Hello! I'm a huge fan, and I have a suggestion!
    Could we get a video on Arduino communicating wirelessly with nRF24L01 modules? There are countless applications for them and I can't find someone that could explain it as amazing as you do!

  • @asakeena3258
    @asakeena3258 ปีที่แล้ว

    Can any one help me with this program, I copied the code directly but every time I try to run it it tells me I can’t reference a list in the range. If anyone has had this problem I would really appreciate some help.

  • @steveholt8991
    @steveholt8991 4 หลายเดือนก่อน

    Did homework ok thank you.

  • @bigbogeyface
    @bigbogeyface 3 ปีที่แล้ว

    I am legend!!! 💪

  • @wishicouldarduino8880
    @wishicouldarduino8880 3 ปีที่แล้ว

    Cool video though I haven't had much time lately .I have played around with python a little .its fun . My robot has three raspberry pi on it so I should be watching more of these.😁👍🤖🛸🛸

  • @chrisingram7277
    @chrisingram7277 3 ปีที่แล้ว

    I am legend, this seem harder than Fortran was a long, long time ago.

  • @bryankohn9660
    @bryankohn9660 3 ปีที่แล้ว

    I got it. Guess "I am legend". I used some of the tricks like printing intermediate steps and I went a step further to "error check" the second program in case someone enters a student name not in the list. It gives you a error message and then asks for a new name.

  • @U_Kamrc
    @U_Kamrc 3 ปีที่แล้ว

    I propose to have a tutorial on VSC debugger

  • @karthi0906
    @karthi0906 2 หลายเดือนก่อน

    Happy engeneer's day sir

  • @danielduplessis7221
    @danielduplessis7221 3 ปีที่แล้ว

    I Am Legend!

  • @erikelfsberg9414
    @erikelfsberg9414 3 ปีที่แล้ว

    I'm legend, this was a tough one But I did it

  • @leefairfield7537
    @leefairfield7537 2 ปีที่แล้ว +1

    As someone who only started python recently and watched all your other vids I think you went a bit fast with this one

  • @JBR7655
    @JBR7655 ปีที่แล้ว

    I don’t understand the reason you dump to f, then read in at f2.

  • @unablewalk4147
    @unablewalk4147 3 ปีที่แล้ว

    Hey pls help me I am getting this error even though I copied whole code same
    PS D:\mann\py> & C:/Users/mann/AppData/Local/Programs/P ython/Python310-32/python.exe d:/mann/py/pickle.py
    Traceback (most recent call last):
    File "d: \mann\py\pickle.py", line 2, in import pickle
    File "d: \mann\py\pickle.py", line 9, in pickle.dump(fruits, f)
    AttributeError: partially initialized module 'pickle' h as no attribute 'dump' (most likely due to a circular i mport)

    • @davesworkplace1616
      @davesworkplace1616 3 ปีที่แล้ว

      If you re-watch the video Paul cautions NOT to name your file "pickle.py" or it can cause problems. Name it "myPickle.py" instead.

  • @dwaipayandutta5441
    @dwaipayandutta5441 3 ปีที่แล้ว +1

    I am legend.

  • @graydhd8688
    @graydhd8688 2 ปีที่แล้ว

    Pee cans? Pickle dumps? This series has taken a strange turn

  • @brucemilyko8549
    @brucemilyko8549 ปีที่แล้ว

    I am Legend!

  • @mandamhlava9301
    @mandamhlava9301 2 ปีที่แล้ว

    I Am Legend.

  • @ricardobjorkeheim775
    @ricardobjorkeheim775 3 ปีที่แล้ว

    I am legend :)

  • @kadhir5738
    @kadhir5738 3 ปีที่แล้ว +6

    I'm first 🤣

  • @Nyviv
    @Nyviv 3 ปีที่แล้ว

    Is it just me or is everyone here is looking forward to doing homework!!

  • @HarshCreatives
    @HarshCreatives 3 ปีที่แล้ว +1

    I am legend

  • @vinayb5076
    @vinayb5076 3 ปีที่แล้ว +1

    I'm 2nd

  • @kevinadesso825
    @kevinadesso825 4 หลายเดือนก่อน

    I AM LEGEND😁

  • @sandbox_beast3846
    @sandbox_beast3846 3 ปีที่แล้ว

    I am also 12 student science student

  • @polito-yd8fp
    @polito-yd8fp ปีที่แล้ว

    I am Legend 😊

  • @evanherpin6980
    @evanherpin6980 2 ปีที่แล้ว

    I'm a legend

  • @MurungiIanMugisha
    @MurungiIanMugisha 11 หลายเดือนก่อน

    am a legend.

  • @neilausten9404
    @neilausten9404 3 ปีที่แล้ว

    I have done two files as you requested and I got everything working in the way you wanted. However, in the second file I had to use len(a) to make it work. I don't think you have covered len so I guess you will do it differently. Also, I had to add a 'break' in my for command to print a final line 'Name does not exist'. Everything works fine but looking forward to your solution.

  • @noweare1
    @noweare1 2 ปีที่แล้ว

    I am lawnchair and I love pickels

  • @MamtaSharma-hc9qt
    @MamtaSharma-hc9qt 3 ปีที่แล้ว

    I am a eighth grade student

  • @snowman58able
    @snowman58able 3 ปีที่แล้ว

    Why didn’t you teach Jason instead of pickle

  • @williamhyrkas698
    @williamhyrkas698 2 ปีที่แล้ว

    I folded yet again.

    • @paulmcwhorter
      @paulmcwhorter  2 ปีที่แล้ว +1

      Dont get discouraged. It is called learning. Over time you will begin to find more success, and the harder it is to get there the more satisfying it will be when you succeed. Just dont giver up.

  • @normanmwanza8225
    @normanmwanza8225 7 หลายเดือนก่อน

    can i call you grandpa

  • @lil_muna
    @lil_muna 3 ปีที่แล้ว

    Sorry but I folded up like a cheap walmart lawn chair