Re: maximum() efficency

2006-03-27 Thread Arne Ludwig
Just for completeness: The functions in Steve's original post named maximum calculate the minimum. Also, timing-wise, on my machine with a random list of 20 integers Steve's iteration version and Mitja's version are about equal, the system built-in is equal or slightly slower, and Paul's versi

Re: using regex to pull out email addresses

2006-03-25 Thread Arne Ludwig
>>> senderlist="na nu [EMAIL PROTECTED] hu [EMAIL PROTECTED] [EMAIL PROTECTED] >>> fa hu" >>> print [ s[0] for s in re.findall("(\w+@(\w+\.)+\w+)",senderlist) ] ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a loop to activate a loop above it

2006-03-23 Thread Arne Ludwig
I think the problem is this line: > x == input('What is x now?: ') which should not have a == but a = -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove integer from float number

2006-03-23 Thread Arne Ludwig
With that terse description and the subject line I would interpret the OP like so: >>> print re.sub(".*\.",".","0.666") .666 >>> print re.sub(".*\.",".","123.666") .666 -- http://mail.python.org/mailman/listinfo/python-list

Re: removing file by inode

2006-03-23 Thread Arne Ludwig
Actually under Linux he could probably pipe "clri %d" to debugfs if that is what he wanted to do. On the other hand he said "unix environment" which could be anything really. -- http://mail.python.org/mailman/listinfo/python-list

Re: removing file by inode

2006-03-23 Thread Arne Ludwig
> under SunOS there was a way to delete a file given it's i-node. Yes and no. You probably mean "clri" which cleared the inode, but did not "remove the file", i.e. all the entries in directories pointing to it. In older Unices there was also "ncheck" to find the filesystem names for inode numbers

Re: question: how to clare the absolute url in a html file

2006-03-23 Thread Arne Ludwig
Perhaps this is what he means: re.sub("http://[^/]*/","/","http://palle.fi/wing/walla.htm";) '/wing/walla.htm' -- http://mail.python.org/mailman/listinfo/python-list

Re: removing file by inode

2006-03-23 Thread Arne Ludwig
Good answer. :) I seriously doubt it is possible except for the trivial solution: def remove_a_file(inode): os.system ("find / -inum %d | xargs rm -f" % (inode)) PS. Don't blame me if this function destroys your hard disk. I wrote it off the top of my head. -- http://mail.python.org/mailm

Re: path to modules per import statement

2006-03-23 Thread Arne Ludwig
Maybe he means: sys.path.append('/my/path') -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows getting local ip address

2006-03-23 Thread Arne Ludwig
That man is a genius: >>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) >>> s.connect(("gmail.com",80)) >>> print s.getsockname() ('192.168.0.174', 2768) >>> s.close() Should work on Windows as well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Server.sendmail with no "to_addrs" parameter.

2006-03-23 Thread Arne Ludwig
Sorry to have caused all that confusion. The quote from RFC822 I gave is really confusing and is indeed not relevant to the original question. As Tim pointed out, the "to_addrs" parameter in smtplib.py::sendmail is translated to the SMTP RCPT TO and thus must contain all the intended recipients whe

Re: Windows getting local ip address

2006-03-22 Thread Arne Ludwig
The second solution can give really weird results though, e.g. on my Linux system I get: >>> gethostbyaddr(gethostname()) ('linux.site', ['linux'], ['127.0.0.2']) A more flexible but potentially unportable way would be: >>> import socket >>> import fcntl >>> import struct >>> >>> def get_ip_addr

Re: Server.sendmail with no "to_addrs" parameter.

2006-03-22 Thread Arne Ludwig
> Can anyone suggest how I can get round this? I have attempted numerous > things, like making my recipient list = [''], but Exchange then tried > to send the mail to "[EMAIL PROTECTED]" . rfc822: Note that the "Bcc" field may be empty, while the "To" field rfc822: is required to have a