Python Beginner Tutorial #9 - File Operations

preview_player
Показать описание
In today's episode we will learn how to operate with files. How to write into files, how to read from files and much more.

Subscribe and Like for more free content!
Рекомендации по теме
Комментарии
Автор

For those with issues, the .txt file must be in the same directory as your Python code/project. In other words, inside your Python project directory unless you specifically state in your code where the file is (I will give an example of it).
Neuralnine has his project (files.py) on his desktop. The "f" is just a variable name. You can use any name you want. It ends in the colon ":" because it is a statement, just like using conditional statements; they end in the colon ":"

# Inside the Python project:

with open('file.txt', 'r') as c:
content = c.read()

print(content)

# Outside the Python project/different directory:
with open("/path/to/directory/myfile.txt", 'r') as variableName:
content = variableName.read()
print(content)

VypeReaper
Автор

This video helped me understand everything I didn’t understand from school. Wish me luck on the certificate

filipborring
Автор

I love your videos! They are short and concise. Kudos!

jrgomez
Автор

Great content! Love your teaching style.

jrgomez
Автор

great job. my concept for open and with open is cleared now. thank you <3

invinciblenoman
Автор

excellent explanation but the screen is very small cant see clearly, better to zoom in a little bit

uniquechannel.
Автор

You can gradually see the number of views decreasing each video. WEAKLINGS...

GriteKidsTV
Автор

It makes no sense that these have so little views. I would have thought that a lot of people started to code at home during the pandemic.

TheMarci
Автор

Amazing content, greetings from brazil!

Alex-jkkd
Автор

Is there a different purpose between single quotation and double quotation in command lines? In the video, I saw, rename("file.txt", "myfile.txt"), and remove('myfile.txt')

omegadrive
Автор

hey why do i have FileNotFoundError: [Errno 2] No such file or directory: 'file.txt' at 4:40 and it always says i can find any file i want to work on.

hammerheadofhorror
Автор

Hi bro! You are great, thanks fol all videos and for the content) I had one problem with the file operations(Error: could not find a file), could you help plz?

trustToLove
Автор

Hey, wanted to get in touch with you and discuss something about your channel. Can we connect on any social media platform?

sameergupta
Автор

Hi my friend!
Please Use bigger fonts when U capturing a video from your screen.
I could watch U with more passion :D
Have a nice day!

nuhhurmanli