Trouble with regular expressions

2009-02-07 Thread LaundroMat
Hi, I'm quite new to regular expressions, and I wonder if anyone here could help me out. I'm looking to split strings that ideally look like this: Update: New item (Household) into a group. This expression works ok: '^(Update:)?(.*)(\(.*\))$' - it returns (Update, New item, (Household)) Some

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread LaundroMat
Thanks all! -- http://mail.python.org/mailman/listinfo/python-list

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread LaundroMat
I did some testing, and calculating the hash value of a 1Gb file does take some time using this method. Would it be wise to calculate the hash value based on say for instance the first Mb? Is there a much larger chance of collusion this way (I suppose not). If it's helpful, the files would

Re: Calculate sha1 hash of a binary file

2008-08-07 Thread LaundroMat
On Aug 7, 2:22 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: LaundroMat [EMAIL PROTECTED] writes: Would it be wise to calculate the hash value based on say for instance the first Mb? Is there a much larger chance of collusion this way (I suppose not). If it's helpful, the files would

Calculate sha1 hash of a binary file

2008-08-06 Thread LaundroMat
Hi - I'm trying to calculate unique hash values for binary files, independent of their location and filename, and I was wondering whether I'm going in the right direction. Basically, the hash values are calculated thusly: f = open('binaryfile.bin') import hashlib h = hashlib.sha1()

Reproducing a web page and add own content to it.

2008-04-08 Thread LaundroMat
Hi - I'm working on a Django powered site where one of the required functionalities is the possibility of displaying the content of external pages, with an extra banner at the top where specific information is displayed. In other words, I'm looking for a way to reproduce an existing web page and

Re: Reproducing a web page and add own content to it.

2008-04-08 Thread LaundroMat
On Apr 8, 2:04 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: LaundroMat wrote: Hi - I'm working on a Django powered site where one of the required functionalities is the possibility of displaying the content of external pages, with an extra banner at the top where specific information

Re: Reproducing a web page and add own content to it.

2008-04-08 Thread LaundroMat
On Apr 8, 4:11 pm, Steve Holden [EMAIL PROTECTED] wrote: LaundroMat wrote: On Apr 8, 2:04 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: LaundroMat wrote: Hi - I'm working on a Django powered site where one of the required functionalities is the possibility of displaying the content

Re: reading id3 tags with python

2006-11-27 Thread LaundroMat
On Nov 24, 5:42 pm, jeff [EMAIL PROTECTED] wrote: [snip] and what do you mean by 'id3reader' cant do directories? my for loop just does each file in the dirextory It's just a friendly warning that you shouldn't suppose that all that is scanned are indeed files, and not directories. --

Re: reading id3 tags with python

2006-11-24 Thread LaundroMat
Heh, a description of the error would be nice indeed. Just a preliminary warning: with this code you will also be parsing directories. id3reader can't handle those ofcourse. Better add a check such as eg: if os.path.isfile(os.path.join(directory, file)): # do your thing laundro --

VLC-python bindings

2006-11-14 Thread LaundroMat
Hi, Has anyone succeeded in compiling the vlc-python bindings on Windows? (as discussed in the vlc development wiki). I have found several compiled bindings, but none were updated for Python 2.4 (or 2.5 for that matter). As I am a complete layman for everything that is C compilation on any

Help me understand this iterator

2006-10-31 Thread LaundroMat
Hi, I've found this script over at effbot (http://effbot.org/librarybook/os-path.htm), and I can't get my head around its inner workings. Here's the script: import os class DirectoryWalker: # a forward iterator that traverses a directory tree def __init__(self, directory):

Re: Help me understand this iterator

2006-10-31 Thread LaundroMat
Ack, I get it now. It's not the variable's name (index) that is hard-coded, it's just that the for...in... loop sends an argument by default. That's a lot more comforting. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me understand this iterator

2006-10-31 Thread LaundroMat
Thanks all, those were some great explanations. It seems I have still still a long way for me to go before I grasp the intricacies of this language. That 'magic index' variable bugs me a little however. It gives me the same feeling as when I see hard-coded variables. I suppose the generator class

Re: Help me understand this iterator

2006-10-31 Thread LaundroMat
On Oct 31, 3:53 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: LaundroMat wrote: That 'magic index' variable bugs me a little however. It gives me the same feeling as when I see hard-coded variables.what magic index? the variable named index is an argument to the method it's used in. Yes, I

Re: What value should be passed to make a function use the default argument value?

2006-10-04 Thread LaundroMat
Rob De Almeida wrote: LaundroMat wrote: Suppose I have this function: def f(var=1): return var*2 What value do I have to pass to f() if I want it to evaluate var to 1? I know that f() will return 2, but what if I absolutely want to pass a value to f()? None doesn't seem to work

Re: What value should be passed to make a function use the default argument value?

2006-10-04 Thread LaundroMat
Antoon Pardon wrote: The problem is like the following. def f(var=1): return var*2 def g(): arg = None try: arg = Try_Processing() / 3 + 1 except Nothing_To_Process: pass if arg is None: return f() else: return f(arg) Now in this case you could start

What value should be passed to make a function use the default argument value?

2006-10-03 Thread LaundroMat
Suppose I have this function: def f(var=1): return var*2 What value do I have to pass to f() if I want it to evaluate var to 1? I know that f() will return 2, but what if I absolutely want to pass a value to f()? None doesn't seem to work.. Thanks in advance. --