Text Files in Python || Python Tutorial || Learn Python Programming

Поділитися
Вставка
  • Опубліковано 28 лис 2017
  • 𝙎𝙩𝙖𝙮 𝙞𝙣 𝙩𝙝𝙚 𝙡𝙤𝙤𝙥 𝙄𝙉𝙁𝙄𝙉𝙄𝙏𝙀𝙇𝙔: snu.socratica.com/python Reading and writing text files is an essential programming skill. Python gives you a simple and powerful tool for working with text files: the open function. This lets you open a wide variety of files - both text or binary - in many different modes (read, write and append). Today we will show you how to read and write text files, and show you several ways to accomplish each task.
    We'd like to recognize our VIP Patrons who sponsored this video on Patreon! Our sincere thanks to Birds Eat Bees, Andrew Mengede, Markie Waid, and Carlos Araujo. Your generous donation helps make these videos happen!
    To learn Python, start our Python Playlist HERE:
    bit.ly/PythonHelloWorld
    Subscribe to Socratica: bit.ly/1ixuu9W
    ♦♦♦♦♦♦♦♦♦♦
    We recommend:
    Python Cookbook, Third edition from O’Reilly
    amzn.to/2sCNYlZ
    The Mythical Man Month - Essays on Software Engineering & Project Management
    amzn.to/2tYdNeP
    Shop Amazon Used Textbooks - Save up to 90%
    amzn.to/2pllk4B
    ♦♦♦♦♦♦♦♦♦♦
    Ways to support our channel:
    ► Join our Patreon : / socratica
    ► Make a one-time PayPal donation: www.paypal.me/socratica
    ► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
    Thank you!
    ♦♦♦♦♦♦♦♦♦♦
    Connect with us!
    Facebook: / socraticastudios
    Instagram: / socraticastudios
    Twitter: / socratica
    ♦♦♦♦♦♦♦♦♦♦
    Python instructor: Ulka Simone Mohanty (@ulkam on Twitter)
    Written & Produced by Michael Harrison (@mlh496 on Twitter)
    ♦♦♦♦♦♦♦♦♦♦

КОМЕНТАРІ • 257

  • @Socratica
    @Socratica  2 роки тому +4

    Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica

  • @AndyChamberlainMusic
    @AndyChamberlainMusic 4 роки тому +108

    "don't be alarmed, but the video you are now watching is stored... in a file."
    gold

  • @unvrknow22
    @unvrknow22 6 років тому +180

    I'm a simple man. I see a new Python video from Socratica and I click thumbs up.

  • @Socratica
    @Socratica  4 роки тому +44

    It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉

    • @almuhimen8023
      @almuhimen8023 4 роки тому +2

      Will you guys make a new course going deeper in python?

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

      I've just started learning Python this week and these video's are a great reference. You've made it so easy to watch and understand. Ulka is perfect, too! 💜

  • @benzoezuur825
    @benzoezuur825 4 роки тому +14

    you explained in 6 minutes what my professor failed to explain in more than an hour! thank you so much!!

  • @MyTube4Utoo
    @MyTube4Utoo 6 років тому +18

    I love Socratia tutorials; they're accurate, concise, and the beautiful presenter's delivery makes them *MUCH* more enjoyable to watch! Definitely different than any other tutorials on the web. I'm not sure who had the idea of this type of presentation, but they hit a home run! Now if I could only squeeze all of this information into this, evidently full, brain.

  • @anteconfig5391
    @anteconfig5391 5 років тому +32

    This is hilarious. I was looking for something else, but I'm glad I found this.
    "As you can see the folder is currently empty... That... is all about to change" Lol. It's so dramatic and so funny too.

  • @mithraskuipers3608
    @mithraskuipers3608 6 років тому +62

    This series is amazing! Please keep up the good work.
    The futuristic atmosphere created in this series makes learning code much more fun!
    Thank you Socratica team :-)

  • @Socratica
    @Socratica  4 роки тому +17

    Welcome to Socratica! You can see our entire Python Playlist here: bit.ly/PythonSocratica
    Subscribe to see all our new videos! bit.ly/SocraticaSubscribe

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

      Hello Socratica, I am having this while I apply this function, please help me
      f = open("C:\Users\hamza\Desktop\family.txt","r") print(f.read()) It keeps giving me the error of Traceback (most recent call last): File "main.py", line 1, in f = open("C:\Users\hamza\Desktop\family.txt","r") FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\hamza\Desktop\family.txt' please help me to resolve this issue Thankyou

  • @ANDRESSANCHEZ-xj4wl
    @ANDRESSANCHEZ-xj4wl 5 років тому +2

    its such a simple and elegant way to explain and yet they manage to include a sense of humor. Congratz with this videos, i love them

  • @Omega-ll4tx
    @Omega-ll4tx Рік тому +1

    This is one the most creative sci fi programming channels on the world wide web! Thank you, the delivery is unparalleled!

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

    Can't stop watching and can't stop learning from the amazing tutor of the universe. My human hats off.

  • @TheDemocraticNationalCommittee
    @TheDemocraticNationalCommittee 5 років тому +2

    has been watching few of the videos, the production quality is exceptional. right to the point. Thank you very much. And sure, subscribed.

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

    Finally I found a well recorded, explained video on text manipulation. Love you Mrs.AI

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

    watched almost 30 vedis.it made me to fall in love with learning python..great work...keep it up

  • @Albert-fe8jx
    @Albert-fe8jx 6 років тому +14

    great script. great delivery. tks. Loved the final closing comment.

  • @erikvelosorj
    @erikvelosorj 6 років тому +22

    Videos like those make you miss a heart to love them.

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

    True entertainment and about as concise as it gets. Love your very special presentations and subtle humour.

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

    I was looking for short videos to teach this. I think this is perfect way to get educated fast, just what I was looking for. Thank you

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

    These are the best videos on UA-cam, I just watch and like everything here... :)

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

    Nice! I'm glad you went into handling exceptions and didnt just leave it showing how to open and read a file.

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

      Andy Dyrcz need to add reception handling around all the file I/O...

  • @Socratica
    @Socratica  4 роки тому +1

    Support what you love! Socratica has a Kickstarter to make more Python: bit.ly/PythonKickstarter

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

    It has never been easier for me to pay attention to a tutorial. This must be spread throughout the land.

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

    Some random youtuber puts some random rubbish on, that has words in the title, that entices people to watch and they get views in the millions, whereas this guy puts a video together that is so useful and gets nothing like the same. Well done very useful

  • @Socratica
    @Socratica  4 роки тому +1

    We're halfway there. We still need your help! Support Socratica Python Kickstarter: bit.ly/PythonKickstarter

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

    Thank you Socratica. Love your videos but especially your humor.

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

    I LOVE how simple you made this 👍🏿

  • @replicasensei1204
    @replicasensei1204 4 роки тому +1

    Loved it.....bravo...
    "
    with Python reading and writing text files is a snap...""

  • @saithejaandra4245
    @saithejaandra4245 4 роки тому +1

    This is Mad Stuff on learning python. Thanks for the video :)
    Looking forward to see the whole playlist.

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

    I have an exam about python in 3 weeks. Although it‘s a bit late for finding this channel I‘m sure that this will help me

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

    Applauding Socratica - the best Python tutorial in the world!

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

    That intro is hilarious I’m sorry “… don’t be alarm…. stored in a file” 😂😂😂

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

    i love her style, it makes it fun, engaging n mysterious

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

    Thanks Socratica as soon as am able I'll donate to your page.

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

    Extremely useful tutorial. Thank you!

  • @marvinreyes7459
    @marvinreyes7459 4 роки тому +30

    I love this girl and how she explains everthing!

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

    Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.

  • @CannabinatedFantasy
    @CannabinatedFantasy 6 років тому +8

    This draws me in enough to want to learn.

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

    that was so good and over the top at the same time

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

    just like you did, but what if i want to do such analysis for 10-15 .txt documents?
    is there a way that i can create a function and pass .txt file as an argument to it?

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

    Why I have not seen you before? Thanks for this amazing video. thumbs up

  • @NielsBaltodano
    @NielsBaltodano 6 років тому +3

    thank you very much Socratica

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

    omg this is amazing n funny .. I'm sure all your videos are great .. thank you keep it up

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

    They are quite engaging vids, congratulation!!

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

    Socratica , Where did you learned this STRANGE style of presenting videos , Cool and Funny!!

  • @GabrielGomes-ow2jp
    @GabrielGomes-ow2jp 5 років тому

    thanks socratica, it helped me so much

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

    What if I wanna write in a line wit separators such as a semicolon? How does the code look like for that kind of scenario?

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

    Bravo! Your tutorials are great!

  • @GabrielsEpicLifeofGoals
    @GabrielsEpicLifeofGoals 4 роки тому +2

    It gave me a FileNotFoundError. Not sure what I did wrong, as I am sure I wrote everything correctly.
    EDIT: Now it's saying "f.write("SOME TEXT")
    ValueError: I/O operation on closed file."

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

    Great videos! Do you plan to do a video about natural language processing and Regular expression?

  • @christophersolies9122
    @christophersolies9122 4 роки тому +3

    I love idea with this "Game interface" :D

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

    Excellent! Thank you! Please make one about sockets! Thumbs up so it can be seen, should anyone else be interested as well.

  • @denniskamonde6836
    @denniskamonde6836 6 років тому +18

    Thanks Socratics, make more videos about classes

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

    Thanks for the updates. But anyone can further explain the "with open() as obj", which is confused for me?

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

    Great video! Thank you.

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

    Awesome as always!!

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

    I think this video put file operations in a great con-text!

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

    Thank you, Symmetra!

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

    the best python edu ever. thanks

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

    this is the best thing i've ever seen

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

    Superb explanation 👍

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

    thanks, this is wonderful!

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

    Can we use with open function just by using its file extension and not a specific file?

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

    Woah, first time here but let me say, what the hell... amazing

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

    I love this, thank you.

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

    I was out of programing now for about 25+ years. I return to it and see this. What in hell did you do? And Python is regarded as one of better languages.

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

    this helped me...thank you

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

    It's a great series, please bring more

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

    Very nice and helpful video. Thanks a lot ^.^

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

    Great as always

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

    it is so funny the intro I love that epic dramma

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

    Thanks for this video it was awesome!
    Could you advice me how to read let's say 4 + 5 from a text file and make this operation using python?

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

    This has got to be the hottest python tutorial series on youtube!
    I'm hooked!

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

    A Python-Kivy series would really be of great help!

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

    Simple and fun way to explain python......

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

    I'm a fan of the Socratica Python videos. Pithy / Pythonic.

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

    Intro was cool :D

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

    Wow amazing
    I’m waiting window form from you

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

    Can anyone say me how text file can be analizing either by comparing an single text file and finding the words in it and also I need an code for the above

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

    Easy to understand 💖💖

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

    Excelente, gracias

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

    best tutorial good job ❤

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

    Check .... and applause for another great video

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

    Cool...I was kind of more interested in the video than in Python :-D

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

    when a write in VS Code:
    f = open("textfile.txt")
    text = f.read()
    f.close()
    print(text)
    and run it, it doesn't write the text, there is no error, but it just does nothing, can someone help me?

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

    Excelente video

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

    WHAT is similar to "vim" command for windows?

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

    Very nice tutorials. 👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏

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

    thank you about this amazin job.

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

    Estamos esperando o Socratica no Brasil!!!!!

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

    even though I'm feeling that I'm learning from AI robot but you give us an extremely informative lesson ,thanks

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

    lmaooooooooo that introduction was so extra i love it

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

    Awesome edu...

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

    Awesome series, but you missed out + and x mode. Especially + when making databases and partitioning blocks is required

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

    Thanks for this amazing video. but i want to know how to read more than one file from a folder.

  • @last_minute_film
    @last_minute_film 4 роки тому +1

    While watching the video I feel like I am in a movie and playing the role of a spy. The way she explains feels like a commander giving orders.

  • @larsl.christensen6560
    @larsl.christensen6560 5 років тому

    This is so good

  • @BR-lx7py
    @BR-lx7py 4 роки тому

    Why does Python add a newline when you print with the "file" keyword? Seems a little arbitrary.

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

    That helped thanks

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

    Hello people, I am having this while I apply this function, please help me
    f = open("C:\Users\hamza\Desktop\family.txt","r") print(f.read()) It keeps giving me the error of Traceback (most recent call last): File "@t", line 1, in f = open("C:\Users\hamza\Desktop\family.txt","r") FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\hamza\Desktop\family.txt' please help me to resolve this issue Thankyou