[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash vs. python scripts - which one is better?



Steve Lamb wrote:

    Quick, take your one liner, have it traverse an entire directory tree
converting all the wavs (regardless of capitalization) to mp3s, oggs and flac,
sorting all 4 into their own directory trees.

    For me I just need to change my small script into a function, wrap it
inside os.walk() and have calls to os.makedirs() and shutil.copy() to do all
the work.  Several more minutes of work and I can add in checks for the same
files with different names, prompt the user to pick a name to use, convert
that one and delete the rest.  Then for my final trick I can wrap it all up as
a library, still retaining its ability to run as a stand alone script, and
import it into other Python scripts.

To make your point, you'd need to do all of the above in one line of Python code.

What a fanboi...

"Quick, write a one-liner while I take 20 minutes to write a real program!"

You're pretty good for a laugh though, Steve.  :-)

Nate



Reply to: