If you like start up a second python interpreter in

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: he value you put in before, with no html at all. A web browser would actually be well within its rights to refuse to render anything at all here, since this clearly isn’t a valid ‘web page’ – but fortunately for us, most web browsers will do the sensible thing and just show the plain text that comes back under these circumstances. Try typing: print server[’pythonTest1’] and you should get back the ‘hello’ string you’ve just put in. Finally, make sure you can unset the value by typing: del(server[’pythonTest1’])3 and once again take a look at the contents of the server store using your browser to convince yourself that it has indeed removed the key/value pair. Just to convince yourself that this is acting as a simple distributed system, set some variable using a browser and the URL method, and once you’ve done that, get that variable in python. Then try it the other way round. If you like, start up a second python interpreter in another window (but from the same directory), and try setting a key/value pair in one, and retrieving it in the other. Now we have a means of causing a ‘central server’ to remember a state set by one program, and retrieving it in a totally independent other program. If you can find someone else who's got to this stage, you’re welcome (in fact, encouraged) to spend a few minutes with them trying to talk to their server instead of your own – all you have to do is to substitute their username instead of yours in the URL of the parameter to the im.IMServer; they can then set a key/value pair, which you can retrieve. IMPORTANT: you MUST do this in co ­operation with the other person. You MUST NOT UNDER ANY CIRCUMSTANCES mess around with someone else’s server without their consent because...
View Full Document

Ask a homework question - tutors are online