Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #I figured I should create code that finds the path of the music file since
- #the used is able to move it around and it would just have more flexability if
- #user would be able to do that. Found an example @ Stackoverflow and modified it
- #so that it would search the file system for our music file.
- def find(pattern, path):
- result = []
- for root, dirs, files in os.walk(path):
- for name in files:
- if fnmatch.fnmatch(name, pattern):
- result.append(os.path.join(root, name))
- return result
- path_to_file = find('music.dat', '/home/')
- path_for_block = path_to_file[0]
- #??? I'm really confused about this part.
- #this outputs the path in this format ['/home/maris/Downloads/music.dat']
- #print(path_to_file)
- #while this outputs the path in this format /home/maris/Downloads/music.dat
- #print(path_to_file[0])
- #why?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement