I am writing a script to clean up my desktop, moving files based on file type. The first step, it would seem, is to ls -1 /Users/user/Desktop (I\'m on Mac OSX).
ls -1 /Users/user/Desktop
After skimming the python documentation to run shell command and obtain the output you can use the subprocess module with the check_output method.
check_output
After that you can simple write that output to a file with the standard Python IO functions: File IO in python.