How to Open and Close a File with a Program in Python | Python Tutorial

preview_player
Показать описание
How to Open and Close a File with Python! Python can open your computer files with a program of your choice! You will necessary commands to, for example, open a .jpg with Photoscape.

CHAPTERS
0:00 Example of Opening and Closing a File
0:10 Syntax to Open and Close a File
1:58 Common Error with Unicode (and solution)
2:34 Final Examples

To open a file
To close a file (after opening)

More Python Videos!

Please like and subscribe to support this channel :) join the journey to 1000 subs!!
Рекомендации по теме
Комментарии
Автор

i've passed through hell and was about to give up after 7h trying to do this and then i found your video, i love you man <3

Senility
Автор

i am not even a beginner on coding yet understand how it works so i wanted to get in by solving my repetetive task as a dj and producer so after some research i got the questions that i need to ask so i ended up with your brilliant video, i learn by examples specially if examples are related to me. i will try to do what i need to do but i will leave it here incase you or someone help me out.
i have 2 programs that i need to use to get ready my dj gig,
mixed in key (mik) and rekordbox(recb)
i download songs and run them with mik and take the files and run them with recb and take the files and sort them in my usb stick to use it in dj gear.
so i want my script to run itself whenever i get new mp3 file on my folder and apply the steps i mentioned.
once again ! thanks a lot

radpeak
Автор

This is epic and thank you man! I'm wondering though, can this be modified/used to iterate through a folder and open multiple files in succession within the same folder? As in setting a filePath of "C:\...\*.txt" and have it open all the files 1 at a time? Trying to figure that out now and having a hell of a time.

artfedderson
Автор

Hi Phil!! Just found your videos, you earned yourself some likes and a sub! A quick question I have though:

I am trying to open a .jar file through Python, and I've got it so that it opens the .jar program, but I can't seem to actually open the file within it. Once running the code, I get a PermissionError from the .jar file. Any ideas on how I can get to fix it?

I just started learning about programming about a week ago, so I'm still new at things. So please be patient if I don't get something right or if you need me to elaborate on something!

Thank you again mate! :D

IACOIACOIACO
Автор

Hello, thank you for your video,
what can I do if the file is already open and I want to close it? I am working with an excel file

alejanbdroechezuria
Автор

hi is there any way that i can open a software that needs username password ? how can i pass my username password using subprocess into the program ?

theghost
Автор

Wait you work that hard and only 3 likes?
1 like from me and a sub too

rudransh_tyagi.