2020-02-07 22:17:19

Guys, i want to build a jump to file function, i will walk over it within using os module, it returns a list but, i don't know how to bounce over in a group of files.

i mean let's say it will list my mp3 files in my music foulder, will list the files, im gunna input a song name and it finds simllar files to it since User can't know the exact name of the file.

Thumbs up

2020-02-08 02:13:24

It really depends.
If you want a song to start with the provided name, a simple startswith function on any file name should do it. If you want the data to be matched in a string regardless of where it is, a simple in test will help you with that. Alternatively, you can look up regular expressions to control your pattern more precisely.

Coding is not hard. No, not at all.
What is hard is making code that accepts different and sometimes unexpected types of input and still works.
This is what truly takes a large amount of effort on a developer's part.

Thumbs up +1

2020-02-08 13:41:04 (edited by Turkce_Rap 2020-02-08 13:42:09)

amerikranian wrote:

It really depends.
If you want a song to start with the provided name, a simple startswith function on any file name should do it. If you want the data to be matched in a string regardless of where it is, a simple in test will help you with that. Alternatively, you can look up regular expressions to control your pattern more precisely.



You know when yuou press "J" key while you're on winump, you try to find a song within typing, then closest results appear in  a list box, got it?

Thumbs up

2020-02-08 16:29:27

Right. A simple string.startswith(message) should do the trick then.

Coding is not hard. No, not at all.
What is hard is making code that accepts different and sometimes unexpected types of input and still works.
This is what truly takes a large amount of effort on a developer's part.

Thumbs up