Python Programming

Negative list index?

Question or problem about Python programming: I’m trying to understand the following piece of code: # node list n = [] for i in xrange(1, numnodes + 1): tmp = session.newobject(); n.append(tmp) link(n[0], n[-1]) Specifically, I don’t understand what the index -1 refers to. If the index 0 refers to the first element, then what […]

Continue Reading
Python is a powerful general-purpose programming language.

Is there a WebSocket client implemented for Python?

Question or problem about Python programming: I found this project: http://code.google.com/p/standalonewebsocketserver/ for a WebSocket server, but I need to implement a WebSocket client in python, more exactly I need to receive some commands from XMPP in my WebSocket server. How to solve the problem: Solution 1: http://pypi.python.org/pypi/websocket-client/ Ridiculously easy to use. sudo pip install websocket-client […]

Continue Reading