How to Write to a text .txt file in Python! Processing Lists, and Outputting Data!

preview_player
Показать описание
This video discusses the method for writing data from python into a text file. This includes step by step instructions for accessing the file from the same folder as the python program, selecting what info you want to store in the file and writing it in. We then go one step further and take info stored in python list variables, modify it and create a text file output with the newly created data!

Learn to read from files here:

Check out my personal channel for more fun science content!

If you have any questions or comments or want to see something specific in the future let us know about it with a comment!

We have hundreds of hours of instructional content on the channel and create more every week so be sure to subscribe to stay up to speed! Thanks for checking out the video and good luck with your projects!

Рекомендации по теме
Комментарии
Автор

This was super easy to understand and really helpful! Thanks loads :)

yasr
Автор

thank u much for the tutorial it helped so much. I was stuck at one point and after watching this I was finally able to understand what was going wrong. Thank you again very much.

kanicabansal
Автор

thank you, that actully helped alot while i was trying to get a list form made

goldenfox
Автор

Thanks so much, you helped me complete my computing assignment :)

mythorium
Автор

Thank you so much for the help. I needed this info for my uni assignment

You’re the best!

senile
Автор

Thanks a lot :) Can u make more python videos pls 🤗 it was really helpfull and easy to understand

tarikselim
Автор

Do you by any chance have a video on appending information at the end of text files? I recall seeing one and want to rewatch it but don't remember on which channel.

gnostie
Автор

Guys, for those who dont want to overwrite the old text with new text add a + '\n' to the and use 'a' instead of 'w' .write so it'll look something like this

file = open('file.txt', 'a')
file.write('some info', '\n')

ahmedtamer
Автор

how do you just check for the last number in the list and then continue the prgram from there? (numbers are 0, 1, 2, ...)

xX_NameHere_Xx
Автор

you explained things better than my lecturer. What about writing to a txt file with password attempts and time and date?

fazdefaz
Автор

How would you alter that final code so that the file would be read from the middle to the end?

kirillzakharov
Автор

After inputting it into the text file, is there a way to make a function to edit or update the grades only?

jrnastyy
Автор

Just tried running my code but it didn't work. I checked and made sure my syntax was correct but yet my text file still came out blank

ufuomaomo-enwefah
Автор

Hey! your video was useful, but i have a little problem and you said it in the video, when i restart the code, the txt file is empty, hopefully you can fix this.

gachaytb
Автор

Sir I have a question if possible please help me-
Write a program that reads all the contents from a file and prints the first, second and last line

gautammazumdar
Автор

How to take input and then write the input data in that file?

audio_masterenghinsongs
Автор

How would you write your terminal output to text file?

ronnieklaase
Автор

I copied everything you did exactly and nothing happens. No errors, the file doesn't open, and nothing gets written.

Spugler
Автор

Is it possible to add text while running the program?? I mean can the user add text in file? Is there any way out?

adithyamadhu
Автор

I have a question, how to print the highest grade and names of students, in decending orders, owh also great video i really needed this for my work, this helps a lot.

haziqkepli