0

Before I begin, I'm terribly sorry if this question is a duplicate, which I think it is. But I've been researching for a solution but I can't find any answers. That's why I'm posting this.

Hi people!

In windows file manager, there's a "open with" function like this.

Something like this

I'm making a music player in python and I though it will be cool to be able to open a music file and it can play with with the app.

My question is: How to open a file with the "open with" function and have the python program read it. I think I have no idea how to get the program to read the file and the Internet didn't have answers(very unusual). Any ideas on which direction I need to go to make a program that can perform such an action. Thank you!

Cheers, CCDY

0

1 Answer 1

-1

In python you can use open function, which AFAIU does exactly what you want. The construction

with open('file.txt') as f: data = f.readlines()

will download all the data from file into the variable data.

Hope it helps!

Sign up to request clarification or add additional context in comments.

1 Comment

I think his question is more related to using the context menu to select the file as argument for his player.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.