Having free time I decided to convert one of my _”Hmmm that would make a good program”_ ideas into reality. Phase 1 involves navigating a website to download a file; phase 2 involves parsing this file.
Phase 2 involves a GUI and I felt, coming from my PHP background, that using Python for this would be simpler than learning C++ (which I’ve done a little of), Java or Delphi. From my reading I believe the overall speed of development should be faster (and hopefully the time required to learn the langauge should be less) - very important if, like me, you are brimming with ideas but don’t usually have the commitment/patience to finish them!
After a couple of days searching I found (via the #python room on irc.freenode.net) a library that should do phase 1: “mechanize”:http://wwwsearch.sourceforge.net/mechanize/. So I install it, open PythonWin, and set about trying to write a script.
To date I’m not having much luck with this library. I’d like to say this was due to the lack of documentation and the horrendously “crap website”:http://www.bt.com that I’m trying to log into and navigate, but I’m sure most of the problem lies with my lack of Python skills ![]()
I’m finding it much harder to pick up Python than I expected
Like (and this is coloured by my playing with mechanize) how do you know when a method returns an object, when does it modify itself [i.e. when do I need @f = b.x()@, then @g = f.y()@ - and when @b.x()@ then @b.y()@?]? This has been a big puzzler with mechanize. How do you tell the return values (ie an object, tuple, string etc.) to expect? There seems to be no equivalent of PHPDoc/JavaDoc where the return values are listed. I find the “Python library reference”:http://www.python.org/doc/lib/ much harder to understand than the “PHP documentation”:http://www.php.net/manual/en/
I have a copy of “Python in a Nutshell”:http://www.amazon.co.uk/exec/obidos/ASIN/0596001886 and the “Python Cookbook”:http://www.amazon.co.uk/exec/obidos/ASIN/0596001673/peterswebpage08 - neither of which are beginners’ books (which is why I bought them: I don’t consider myself a beginner as I can program, albeit in PHP and Prolog rather than proper, well-respected langauges. Stop sniggering, you in the back row - Prolog wasn’t my choice!). Can anyone recommend anything else?
[Mood: frustrated]
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment