[Tutor] My horrible looking program needs improvement.

Peter van der Does peter at avirtualhome.com
Mon Nov 24 20:21:31 CET 2008


On Mon, 24 Nov 2008 11:00:59 -0500
Peter van der Does <peter at avirtualhome.com> wrote:

> I wrote my 1st Python program and it works as I want it to work but
> ,IMHO, it looks horrible.
> 
> As to what my program does:
> It downloads a file from the web, downloads .htaccess and Apache log
> file from a FTP site, using the IP's from the Apache log it checks if
> the IP exists in the web-file, if it is it's added to the .htaccess as
> a deny from.
> 
> Most actions are logged to file and console.
> 
> Why I think it looks horrible:
> Everything is in main(), I would like to use functions but ran into
> problems with the scope of my variables.
> The CLI arguments check is just a bunch of IF's
> 
> Is this the place where somebody could go over my program and give
> some pointers on how to improve the structure or is there a forum out
> on the Net that can help me out.
> 
> If this is the place, how do I show the program, in-line or attached?
> 
> Thanks in  advance.
> 
OK, I put the code here:

http://pdoes.pastebin.com/m47109194

Thanks people.

-- 
Peter van der Does

GPG key: E77E8E98

WordPress Plugin Developer
http://blog.avirtualhome.com

GetDeb Package Builder/GetDeb Site Coder
http://www.getdeb.net - Software you want for Ubuntu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20081124/e84c9cd0/attachment.pgp>


More information about the Tutor mailing list