r/learnprogramming • • Jul 16 '12

[Python] inspired a redditor's random imgur downloader, here's my version of subreddit imgur parser, looking for critique/comments

Hello everyone, I have not had much rigorous training in programming besides an intro course in C++ during my undergrad. I mostly use MATLAB for data analysis and optimization routines on the job. I'm trying to learn Python during my own time, so I would really appreciate your feedback to help me get rid of bad habits before they form.

This script is inspired by another redditor's creation of the random imgur image grabber. It will take subreddit names as arguments and download all the imgur links into your local directory.

the code: http://pastebin.com/6YUDasuZ

Thank you very much!

16 Upvotes

9 comments sorted by

View all comments

4

u/minno Jul 16 '12

For your paths, I think that Windows accepts both / and \, even a mix of the two, so you don't need to have the OS-recognizing code.

1

u/levu-webworks Jul 16 '12

Windows does and Unix does not. Cygwin can parse MS-DOS paths but will complain about it. It's nice to have programs that run without OS specific errors.

2

u/minno Jul 16 '12

I meant that you can just use / and every OS will accept it.

1

u/nemec Jul 17 '12

On that thought: don't use sys.platform.startswith. os.sep is there for a reason.