Re: [Tutor] Getting web pages and formatting text

2005-08-05 Thread David Holland
Alan, Kent, Thanks for that I will have a look and hopefully come back with a complete script next week. DavidAlan G [EMAIL PROTECTED] wrote: Two questions :- 1) Is it possible to download to your hard drive using python various web pages ie if the pages have the structure

[Tutor] An editable buffer for the Python shell (similar to '\e' on sql prompts)

2005-08-05 Thread Steve
Hi, When working in the python command shell, I often end up writing more than 10+ lines of indented code before making a stupid typo. This got irritating enough for me to do something about it. So, here's an 'InteractiveConsole with an editable buffer'.

Re: [Tutor] What's the invalid syntax? Code supplied

2005-08-05 Thread Nathan Pinno
Hi all, It's Zoffee now, thanks to a Google search. Don't want to confuse customers. :) For your info, Zoffee is a company where I sell computer programs online which I write. Simple enough, eh? G2G, Nathan Pinno, Crew, Camrose McDonalds and owner/operator of Zoffee - Original Message

[Tutor] The new iMesh

2005-08-05 Thread [EMAIL PROTECTED]
tutor@python.org, I'd like to invite you to try the new iMesh! iMesh 5 lets you search and download music, videos, images and more. The Professional version is now FREE. It's also 100% clean. NO POPUPS, NO SPYWARE and NO ADWARE. iMesh 5 lets you connect to multiple file

[Tutor] IP Address from Python module?

2005-08-05 Thread Joseph Quigley
Is it possible to get my internet and/or network IP address from Python? Is there any other way to get it? Oh. If you're wondering what I mean by Internet and/or network IP I'm talking about the 4 sequence IP (IPv4) (used primarily in small networks) and the 6 sequence IP (IPv6) found on the

[Tutor] Is there a qucker method than the following?

2005-08-05 Thread Nathan Pinno
Hi all, Is there a quicker method than the following? import randomnumbers = [0,1,2,3,4,5,6,7,8,9,10,11,12]cards = ["Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King"]hand = {numbers:cards} def menu(): print "1. Deal a hand" print "2. Exit" def

Re: [Tutor] Is there a qucker method than the following?

2005-08-05 Thread Luis N
On 8/5/05, Nathan Pinno [EMAIL PROTECTED] wrote: Hi all, Is there a quicker method than the following? import random numbers = [0,1,2,3,4,5,6,7,8,9,10,11,12] cards = [Ace,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Jack,Queen,King] hand = {numbers:cards} hand is invalid

[Tutor] Functional question

2005-08-05 Thread Bernard Lebel
Hello, This question is not strictly bound to Python, but rather some functional programming problem, I hope someone can help me or suggest ressources. 1 -- I have a list of lists. Each of these lists has 3 elements: a string, and two integers. Thoughout the lists, there are only two different

[Tutor] What's the invalid syntax? Code supplied

2005-08-05 Thread Nathan Pinno
Hi all, What's the invalid syntax? Here is the code: import randomhand = { '0' : ["Ace"] '1' : ["Two"] '2' : ["Three"] '3' : ["Four"] '4' : ["Five"] '5' : ["Six"] '6' : ["Seven"] '7' : ["Eight"] '8' : ["Nine"] '9' : ["Ten"] '10' : ["Jack"] '11' : ["Queen"] '12' : ["King"] }types = { '0'

Re: [Tutor] What's the invalid syntax? Code supplied

2005-08-05 Thread Danny Yoo
What's the invalid syntax? Here is the code: Hi Nathan, You need to have a comma between the items of a dictionary. For example: ## numerals = { ... 0 : 'zero', ... 1 : 'one', ... } numerals[0] 'zero' numerals[1] 'one' ## Some comments on your code. I notice that

Re: [Tutor] IP Address from Python module?

2005-08-05 Thread Danny Yoo
On Fri, 5 Aug 2005, Joseph Quigley wrote: Is it possible to get my internet and/or network IP address from Python? Is there any other way to get it? Hi Joe, I think you're looking for socket.gethostbyname(). http://www.python.org/doc/lib/module-socket.html#l2h-2594 Here's an example

Re: [Tutor] Functional question

2005-08-05 Thread Bernard Lebel
Thanks Kent. I had tried the very same thing, but with a list instead of a tuple, and got an got this: dMap[ ['allo','bonjour'] ] = 'salut' Traceback (most recent call last): File stdin, line 1, in ? TypeError: list objects are unhashable It never crossed my mind that a tuple would do it.

Re: [Tutor] What's the invalid syntax? Code supplied

2005-08-05 Thread Terry Carroll
On Fri, 5 Aug 2005, Nathan Pinno wrote: What's the invalid syntax? Here is the code: Nathan, My method when encountering a syntax error like this is to look at the part of my code that's generating the syntax error, and see what structure or function it's using. Then find a program segment

Re: [Tutor] IP Address from Python module?

2005-08-05 Thread Terry Carroll
On Fri, 5 Aug 2005, Joseph Quigley wrote: Is it possible to get my internet and/or network IP address from Python? import socket ipaddr = socket.gethostbyname(socket.gethostname()) Some users report this gives a meaningless '127.0.0.1' (i.e., localhost), though. But try it and see. It