I am trying to save the output of >>>dirs = os.system('ls') into a variable but I do not need any output to the screen (altho it doesn't hurt). How do I go about this? My fat book only explains how to get output to the screen. I could do >>>os.system('ls > file') >>>f = open('file') >>>dirs = f.readlines() but it looks crude. Is there a better way?