Posted: 11/2/2009 5:06:03 PM EDT
|
Does anybody here know Python?
I'm trying to teach myself Python with the first thing that i want to program is something small that will use a REST interface to pull down a JSON file and parse it. I'm just not able to wrap my head around this. I'm trying to pull myself into the 21st century since right now I program in VBScript and that scares my co-workers. Please help |
|
I learned how with this book:
http://www.amazon.com/Python-Programming-Absolute-Beginner-Michael/dp/1592000738 I am not familiar with what you are trying to accomplish, but I have been able to find out how to do most anything with Python by Googling for info. |
I would recommend Ruby and Rails. YMMV. eta: A ruby programming guide is available here: http://www.ruby-doc.org/docs/ProgrammingRuby/ |
|
Quoted:
I'd recommend "Learning Python", by Oreilly. It's written by Mark Lutz, who I've actually taken the "Learning Python" course from, and I'd say it's well worth it. +1 A very good book. As for pulling down info from a website (REST doesn't matter much, you're just getting some data) I'd use urllib2 and simplejson modules. Are you on a windows box or Linux? Its easiest if you have setuptools installed, then you can just easy_install the simplejson module. This is with python2.6 (which has a json module included): #!/usr/bin/env python2.6 """ Get some JSON data from a URL passed on the commandline Public Domain """ import urllib2 import json import sys def getJSONPage( url ): """ Get the JSON response from a url """ data = urllib2.urlopen(url).read() return json.loads(data) if __name__ == '__main__': if len(sys.argv) > 1: for url in sys.argv[1:]: print "FROM: %s" % (url) print getJSONPage(url) else: print "Usage: %s <URL>" % (sys.argv[0]) Which looks like crap when passed through arfcom's filter –– it strips out all the indenting (4 spaces) which is essential for the program to work. Here's a paste.org of the code, nicely indented and highlighted. If you have any questions, just ask. I hate to see people fall down the PHP rabbit hole |
|
Quoted:
http://home.gci.net/~johns/new_build.jpg I would recommend Ruby and Rails. YMMV. eta: A ruby programming guide is available here: http://www.ruby-doc.org/docs/ProgrammingRuby/ +1 - Ruby is a great "modern" language and Rails is a fantastic web application framework. |
|
Quoted:
Quoted:
People with brain damage, like me, use PERL.
-Foxxz There is a recovery program for that. I too used to suffer from Perl. Suffer? What are you talking about? I love being mental! I'm off to play tetris!
-Foxxz |
|
Quoted: Same here. Wrote Perl code for the last 5 years, started Python - have never gone back to Perl - other than to rewrite what I previously did in Perl.Quoted: People with brain damage, like me, use PERL. ![]() -Foxxz There is a recovery program for that. I too used to suffer from Perl. |

