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)
♦♦♦♦♦♦♦♦♦♦
Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica
"don't be alarmed, but the video you are now watching is stored... in a file."
gold
I'm a simple man. I see a new Python video from Socratica and I click thumbs up.
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!! 💜🦉
Will you guys make a new course going deeper in python?
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! 💜
you explained in 6 minutes what my professor failed to explain in more than an hour! thank you so much!!
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.
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.
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 :-)
Welcome to Socratica! You can see our entire Python Playlist here: bit.ly/PythonSocratica
Subscribe to see all our new videos! bit.ly/SocraticaSubscribe
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
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
This is one the most creative sci fi programming channels on the world wide web! Thank you, the delivery is unparalleled!
Can't stop watching and can't stop learning from the amazing tutor of the universe. My human hats off.
has been watching few of the videos, the production quality is exceptional. right to the point. Thank you very much. And sure, subscribed.
Finally I found a well recorded, explained video on text manipulation. Love you Mrs.AI
watched almost 30 vedis.it made me to fall in love with learning python..great work...keep it up
great script. great delivery. tks. Loved the final closing comment.
Videos like those make you miss a heart to love them.
True entertainment and about as concise as it gets. Love your very special presentations and subtle humour.
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
These are the best videos on UA-cam, I just watch and like everything here... :)
Nice! I'm glad you went into handling exceptions and didnt just leave it showing how to open and read a file.
Andy Dyrcz need to add reception handling around all the file I/O...
Support what you love! Socratica has a Kickstarter to make more Python: bit.ly/PythonKickstarter
It has never been easier for me to pay attention to a tutorial. This must be spread throughout the land.
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
We're halfway there. We still need your help! Support Socratica Python Kickstarter: bit.ly/PythonKickstarter
Thank you Socratica. Love your videos but especially your humor.
I LOVE how simple you made this 👍🏿
Loved it.....bravo...
"
with Python reading and writing text files is a snap...""
This is Mad Stuff on learning python. Thanks for the video :)
Looking forward to see the whole playlist.
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
Applauding Socratica - the best Python tutorial in the world!
That intro is hilarious I’m sorry “… don’t be alarm…. stored in a file” 😂😂😂
i love her style, it makes it fun, engaging n mysterious
Thanks Socratica as soon as am able I'll donate to your page.
Extremely useful tutorial. Thank you!
I love this girl and how she explains everthing!
wamen ?
Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.
This draws me in enough to want to learn.
that was so good and over the top at the same time
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?
Why I have not seen you before? Thanks for this amazing video. thumbs up
thank you very much Socratica
omg this is amazing n funny .. I'm sure all your videos are great .. thank you keep it up
They are quite engaging vids, congratulation!!
Socratica , Where did you learned this STRANGE style of presenting videos , Cool and Funny!!
thanks socratica, it helped me so much
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?
Bravo! Your tutorials are great!
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."
Great videos! Do you plan to do a video about natural language processing and Regular expression?
I love idea with this "Game interface" :D
Excellent! Thank you! Please make one about sockets! Thumbs up so it can be seen, should anyone else be interested as well.
Thanks Socratics, make more videos about classes
Dennis Kamonde I agree!
Thanks for the updates. But anyone can further explain the "with open() as obj", which is confused for me?
Great video! Thank you.
Awesome as always!!
I think this video put file operations in a great con-text!
Thank you, Symmetra!
the best python edu ever. thanks
this is the best thing i've ever seen
Superb explanation 👍
thanks, this is wonderful!
Can we use with open function just by using its file extension and not a specific file?
Woah, first time here but let me say, what the hell... amazing
I love this, thank you.
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.
this helped me...thank you
It's a great series, please bring more
Very nice and helpful video. Thanks a lot ^.^
Great as always
it is so funny the intro I love that epic dramma
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?
This has got to be the hottest python tutorial series on youtube!
I'm hooked!
A Python-Kivy series would really be of great help!
Simple and fun way to explain python......
I'm a fan of the Socratica Python videos. Pithy / Pythonic.
concise and fact filled
Intro was cool :D
Wow amazing
I’m waiting window form from you
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
Easy to understand 💖💖
Excelente, gracias
best tutorial good job ❤
Check .... and applause for another great video
Cool...I was kind of more interested in the video than in Python :-D
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?
Excelente video
WHAT is similar to "vim" command for windows?
Very nice tutorials. 👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏
thank you about this amazin job.
Estamos esperando o Socratica no Brasil!!!!!
even though I'm feeling that I'm learning from AI robot but you give us an extremely informative lesson ,thanks
lmaooooooooo that introduction was so extra i love it
Awesome edu...
Awesome series, but you missed out + and x mode. Especially + when making databases and partitioning blocks is required
Thanks for this amazing video. but i want to know how to read more than one file from a folder.
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.
This is so good
Why does Python add a newline when you print with the "file" keyword? Seems a little arbitrary.
That helped thanks
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