| | |
expanding music chooser
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
i have this code:
that i got with help from the daniweb comunity but i want to expand it so that instead of only choosing from a folder i can just use
import webbrowser, random
import os
import os.path
running = 1
DIR="C:/Documents and Settings/Owner/My Documents/georges poopy/main music/"
music = filter(lambda x: x.lower().endswith("mp3"),os.listdir(DIR))
music = list(music)
choice = int(raw_input("Press 1 to play a new song"))
while running == 1:
if choice == 1:
song = random.choice(music)
webbrowser.open(os.path.join(DIR,song))
choice = float(raw_input("Press 1 to play a new song"))DIR="C:/" and also i would like to know if there is a way to remove thechoice = float(raw_input("press 1 to play a new song")) so that it will simply choose a new song at the end of the old one don't judge me because I'm a year 8!
'it is better to fight for something than to live for nothing'General George S Patton
'it is better to fight for something than to live for nothing'General George S Patton
![]() |
Other Threads in the Python Forum
- Previous Thread: calculating standard deviation
- Next Thread: Need help with simple python problem.
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied apache application argv array beginner book change code color converter countpasswordentry dan08 dictionary dynamic edit editing enter examples excel file filename float format function gui homework import inches input java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql newb number numbers numeric output parameters parsing path phonebook plugin port prime programming projects py2exe pygame pyopengl pyqt pysimplewizard python random recursion redirect remote reverse scrolledtext session simple smtp software sprite statictext string strings syntax table tennis terminal text thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable windows wordgame wxpython






