writing large files quickly

2006-01-27 Thread rbt
I've been doing some file system benchmarking. In the process, I need to create a large file to copy around to various drives. I'm creating the file like this: fd = file('large_file.bin', 'wb') for x in xrange(40960): fd.write('0') fd.close() This takes a few minutes to do. How can I

Re: writing large files quickly

2006-01-27 Thread rbt
Grant Edwards wrote: On 2006-01-27, Tim Chase [EMAIL PROTECTED] wrote: fd.write('0') [cut] f = file('large_file.bin','wb') f.seek(40960-1) f.write('\x00') While a mindblowingly simple/elegant/fast solution (kudos!), the OP's file ends up with full of the character zero (ASCII 0x30),

Re: writing large files quickly

2006-01-27 Thread rbt
Grant Edwards wrote: On 2006-01-27, rbt [EMAIL PROTECTED] wrote: I've been doing some file system benchmarking. In the process, I need to create a large file to copy around to various drives. I'm creating the file like this: fd = file('large_file.bin', 'wb') for x in xrange(40960

Re: writing large files quickly

2006-01-27 Thread rbt
Donn Cave wrote: In article [EMAIL PROTECTED], rbt [EMAIL PROTECTED] wrote: Won't work!? It's absolutely fabulous! I just need something big, quick and zeros work great. How the heck does that make a 400 MB file that fast? It literally takes a second or two while every other solution takes

Re: writing large files quickly

2006-01-27 Thread rbt
Grant Edwards wrote: On 2006-01-27, rbt [EMAIL PROTECTED] wrote: Hmmm... when I copy the file to a different drive, it takes up 409,600,000 bytes. Also, an md5 checksum on the generated file and on copies placed on other drives are the same. It looks like a regular, big file... I don't get

Re: Apache with Python 2.4 Need Help !!!

2006-01-25 Thread rbt
Sybren Stuvel wrote: pycraze enlightened us with: I am currently using Fedora Core - 3 with apache 2.0 Web Server and Python 2.4 . [...] i would like to know have apache released any version that can be successfully use Python 2.4 ( with mod-python module ) using Fedora Core -3 . I don't

Re: os.unlink() AND win32api.DeleteFile()

2006-01-24 Thread rbt
Tim Golden wrote: [rbt] | Can someone detail the differences between these two? On | Windows which is preferred? Looks like that's been answered elsewhere. | Also, is it true that win32api.DeleteFile() can remove the 'special' | files located in the 'special' folders only accessible

os.unlink() AND win32api.DeleteFile()

2006-01-23 Thread rbt
Can someone detail the differences between these two? On Windows which is preferred? Also, is it true that win32api.DeleteFile() can remove the 'special' files located in the 'special' folders only accessible by the shell object such as Temporary Internet Files, etc. Thanks! --

Re: a more precise re for email addys

2006-01-19 Thread rbt
[EMAIL PROTECTED] wrote: Does it really need to be a regular expression? Why not just write a short function that breaks apart the input and validates each part? def IsEmail(addr): 'Returns True if addr appears to be a valid email address' # we don't allow stuff like [EMAIL

a more precise re for email addys

2006-01-18 Thread rbt
Is it possible to write an re that _only_ matches email addresses? I've been googling around and have found several examples on the Web, but all of them produce too many false positives... here are examples from Google that I've experimented with: re.compile('([EMAIL PROTECTED])')

Re: a more precise re for email addys

2006-01-18 Thread rbt
Jim wrote: There is a precise one in a Perl module, I believe. http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html Can you swipe that? Jim I can swipe it... but it causes my head to explode. I get unbalanced paratheses errors when trying to make it work as a python re... it makes

Re: a more precise re for email addys

2006-01-18 Thread rbt
[EMAIL PROTECTED] wrote: Does it really need to be a regular expression? Why not just write a short function that breaks apart the input and validates each part? def IsEmail(addr): 'Returns True if addr appears to be a valid email address' # we don't allow stuff like [EMAIL

recursively removing files and directories

2006-01-16 Thread rbt
What is the most efficient way to recursively remove files and directories? Currently, I'm using os.walk() to unlink any files present, then I call os.walk() again with the topdown=False option and get rid of diretories with rmdir. This works well, but it seems that there should be a more

Re: recursively removing files and directories

2006-01-16 Thread rbt
Tim N. van der Leeuw wrote: Wasn't this the example given in the Python manuals? Recursively deleting files and directories? I don't know... I wrote it without consulting anything. Hope I'm not infringing on a patent :) -- http://mail.python.org/mailman/listinfo/python-list

Re: recursively removing files and directories

2006-01-16 Thread rbt
Fuzzyman wrote: shutil.rmtree Many thanks. I'll give that a go! You might need an ``onerror`` handler to sort out permissions. There is one for just this in pathutils : http://www.voidspace.org.uk/python/pathutils.html All the best, Fuzzyman

Re: Space left on device

2006-01-16 Thread rbt
sir_alex wrote: Is there any function to see how much space is left on a device (such as a usb key)? I'm trying to fill in an mp3 reader in a little script, and this information could be very useful! Thanks! On windows with the win32 extensions, you might try this: # Get hard drive info

return values of os.system() on win32

2006-01-13 Thread rbt
Is it safe to say that any value returned by os.system() other than 0 is an error? if os.system('winver') != 0: print Winver failed! else: print Winver Worked. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: return values of os.system() on win32

2006-01-13 Thread rbt
Peter Hansen wrote: rbt wrote: Is it safe to say that any value returned by os.system() other than 0 is an error? if os.system('winver') != 0: print Winver failed! else: print Winver Worked. According to the docs, assuming that *in general* would be an error, but it's

Re: return values of os.system() on win32

2006-01-13 Thread rbt
Paul Watson wrote: rbt wrote: Is it safe to say that any value returned by os.system() other than 0 is an error? if os.system('winver') != 0: print Winver failed! else: print Winver Worked. Thanks! What are you really seeking to do? This is a corner case. I'm trying

loops breaks and returns

2006-01-01 Thread rbt
Is it more appropriate to do this: while 1: if x: return x Or this: while 1: if x: break return x Or, does it matter? -- http://mail.python.org/mailman/listinfo/python-list

idle with -n switch

2006-01-01 Thread rbt
What impact does the -n option have on idle.py on Windows? -- http://mail.python.org/mailman/listinfo/python-list

compare dictionary values

2005-12-30 Thread rbt
: print new, New file(s)!!! My key-values pairs are filepaths and their modify times. I want to identify files that have been updated or added since the script last ran. Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: compare dictionary values

2005-12-30 Thread rbt
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], rbt wrote: What's a good way to compare values in dictionaries? Look them up and then compare!? ;-) I want to find values that have changed. I look for new keys by doing this: new = [k for k in file_info_cur.iterkeys() if k

reading files into dicts

2005-12-29 Thread rbt
What's a good way to write a dictionary out to a file so that it can be easily read back into a dict later? I've used realines() to read text files into lists... how can I do the same thing with dicts? Here's some sample output that I'd like to write to file and then read back into a dict:

Re: reading files into dicts

2005-12-29 Thread rbt
Gary Herron wrote: rbt wrote: What's a good way to write a dictionary out to a file so that it can be easily read back into a dict later? I've used realines() to read text files into lists... how can I do the same thing with dicts? Here's some sample output that I'd like to write to file

Re: html resize pics

2005-12-28 Thread rbt
Peter Hansen wrote: rbt wrote: I use Python to generate html pages. I link to several large images at times. I'd like to display a thumbnail image that when clicked will go to the original, large jpg for a more detailed view. I use PIL with the thumbnail() function for that... depending

html resize pics

2005-12-27 Thread rbt
What's a good way to resize pictures so that they work well on html pages? I have large jpg files. I want the original images to remain as they are, just resize the displayed image in the browser. -- http://mail.python.org/mailman/listinfo/python-list

Re: html resize pics

2005-12-27 Thread rbt
Peter Hansen wrote: rbt wrote: What's a good way to resize pictures so that they work well on html pages? I have large jpg files. I want the original images to remain as they are, just resize the displayed image in the browser. These two things are mutually exclusive by most people's

Re: Windows and python execution

2005-12-26 Thread rbt
Mark Carter wrote: rzed wrote: Mark Carter [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: What I would like to do it type something like myscript.py instead of python myscript.py As another poster points out, be sure that your Python is on your path. And there is a PATHEXT

Re: Beautiful Python

2005-12-26 Thread rbt
[EMAIL PROTECTED] wrote: Gekitsuu wrote: I've been reading a lot of python modules lately to see how they work and I've stumbled across something that's sort of annoying and wanted to find out of there was a good reason behind it. In a Perl program when you're calling other modules you'll add

Re: python coding contest

2005-12-25 Thread rbt
Steven D'Aprano wrote: On Sun, 25 Dec 2005 18:05:37 +0100, Simon Hengel wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm envisioning lots of convoluted one-liners which are more suitable to a different P-language... :-) I feel that python is more beautiful and readable, even if

Re: python coding contest

2005-12-25 Thread rbt
Simon Hengel wrote: Hello, we are hosting a python coding contest an we even managed to provide a price for the winner... http://pycontest.net/ The contest is coincidentally held during the 22c3 and we will be present there.

Re: python coding contest

2005-12-25 Thread rbt
Tim Hochberg wrote: Is it necessary to keep the input parameter as 'input'? Reducing that to a single character drops the length of a program by at least 8 characters. Technically it changes the interface of the function, so it's a little bogus, but test.py doesn't check. (Personally I

Re: Guido at Google

2005-12-23 Thread rbt
Anand wrote: It's like having James Bond as your very own personal body guard ;) That is such a nice quote that I am going to put it in my email signature ! :) -Anand Go right ahead. Perhaps we should do one for Perl too: It's like having King Kong as your very own personal body guard

Re: Guido at Google

2005-12-23 Thread rbt
Luis M. González wrote: rbt wrote: Go right ahead. Perhaps we should do one for Perl too: It's like having King Kong as your very own personal body guard ;) Good analogy: You know, they call Perl the eight-hundred-pound gorilla of scripting languages. Absolutely. It's big, hairy, smelly

Re: Indentation/whitespace

2005-12-23 Thread rbt
BartlebyScrivener wrote: What's needed is STRICTER whitespace enforcement, especially on April Fools Day. Some call it whitespace fascism. http://www.artima.com/weblogs/viewpost.jsp?thread=101968 I've only been coding Python for about 3 years now. C is the only other language I'm

Re: Indentation/whitespace

2005-12-23 Thread rbt
Gary Herron wrote: rbt wrote: BartlebyScrivener wrote: What's needed is STRICTER whitespace enforcement, especially on April Fools Day. Some call it whitespace fascism. http://www.artima.com/weblogs/viewpost.jsp?thread=101968 I've only been coding Python for about 3 years now. C

deal or no deal

2005-12-22 Thread rbt
The house almost always wins or are my assumptions wrong... import random amounts = [.01, 1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 750, 1000, 5000, 1, 25000, 5, 75000, 10, 20, 30, 40, 50, 75, 100] results = [] count = 0 while

Re: deal or no deal

2005-12-22 Thread rbt
Bengt Richter wrote: On Thu, 22 Dec 2005 09:29:49 -0500, rbt [EMAIL PROTECTED] wrote: The house almost always wins or are my assumptions wrong... import random amounts = [.01, 1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 750, 1000, 5000, 1, 25000, 5, 75000, 10

Re: Guido at Google

2005-12-22 Thread rbt
Alex Martelli wrote: Rhetorical questions are a perfectly legitimate style of writing (although, like all stylistic embellishments, they can be overused, and can be made much less effective if murkily or fuzzily phrased), of course. Also, email doesn't convey rhetorical questions that well.

Re: Guido at Google

2005-12-22 Thread rbt
Luis M. González wrote: Java = Sun .Net = Microsoft C# = Microsoft Linux = too many big name IT companies to mention Python = ? I know at least one company responsible for a linux distro (Cannonical - Ubuntu), which encourages and even pays programmers for developing

os.path.splitext() and case sensitivity

2005-12-21 Thread rbt
Hi, Is there a way to make os.path.splitext() case agnostic? def remove_file_type(target_dir, file_type): for root, dirs, files in os.walk(target_dir): for f in files: if os.path.splitext(os.path.join(root, f))[1] in file_type: pass

Re: os.path.splitext() and case sensitivity

2005-12-21 Thread rbt
Richie Hindle wrote: [rbt] Is there a way to make os.path.splitext() case agnostic? def remove_file_type(target_dir, file_type): for root, dirs, files in os.walk(target_dir): for f in files: if os.path.splitext(os.path.join(root, f))[1] in file_type

Re: os.path.splitext() and case sensitivity

2005-12-21 Thread rbt
Juho Schultz wrote: rbt wrote: Hi, Is there a way to make os.path.splitext() case agnostic? def remove_file_type(target_dir, file_type): for root, dirs, files in os.walk(target_dir): for f in files: if os.path.splitext(os.path.join(root, f))[1] in file_type

Re: Guido at Google

2005-12-21 Thread rbt
Alex Martelli wrote: I don't think there was any official announcement, but it's true -- he sits about 15 meters away from me;-). For Americans: 15 meters is roughly 50 feet. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute an EXE via os.system() with spaces in the directory name?

2005-12-06 Thread rbt
[EMAIL PROTECTED] wrote: This comes up from time to time. The brain damage is all Windows', not Python's. Here's one thread which seems to suggest a bizarre doubling of the initial quote of the commandline.

extract python install info from registry

2005-12-06 Thread rbt
On windows xp, is there an easy way to extract the information that Python added to the registry as it was installed? -- http://mail.python.org/mailman/listinfo/python-list

Re: extract python install info from registry

2005-12-06 Thread rbt
Laszlo Zsolt Nagy wrote: rbt wrote: On windows xp, is there an easy way to extract the information that Python added to the registry as it was installed? Using regedit.exe, look at the registry keys and values under HKEY_LOCAL_MACHINE\Software\Python If you need to know how

Re: extract python install info from registry

2005-12-06 Thread rbt
gene tani wrote: There's more to it than that... isn't there? I've used _winreg and the win32 extensions in the past when working with the registry. I thought perhaps someone had already scripted something to extract this info. Yes, a small firm named Microsoft has done this (but not tested

speeding up Python when using wmi

2005-11-28 Thread rbt
Here's a quick and dirty version of winver.exe written in Python: http://filebox.vt.edu/users/rtilley/public/winver/winver.html It uses wmi to get OS information from Windows... it works well, but it's slow... too slow. Is there any way to speed up wmi? In the past, I used the platform and sys

Re: speeding up Python when using wmi

2005-11-28 Thread rbt
Tim Golden wrote: [rbt] Here's a quick and dirty version of winver.exe written in Python: [.. snip ..] It uses wmi to get OS information from Windows... it works well, but it's slow... too slow. Is there any way to speed up wmi? In the past, I used the platform and sys modules to do

Re: socketServer questions

2005-10-10 Thread rbt
On Sat, 2005-10-08 at 14:09 -0700, Paul Rubinhttp: wrote: rbt [EMAIL PROTECTED] writes: Off-topic here, but you've caused me to have a thought... Can hmac be used on untrusted clients? Clients that may fall into the wrong hands? How would one handle message verification when one cannot

One last thing about SocketServer

2005-10-10 Thread rbt
to manage and/or monitor them? The SocketServer module is great, but it seems to hide too many details of what it's up to! Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: socketServer questions

2005-10-10 Thread rbt
On Mon, 2005-10-10 at 05:54 -0700, Paul Rubinhttp: wrote: rbt [EMAIL PROTECTED] writes: I don't understand the question. HMAC requires that both ends share a secret key; does that help? That's what I don't get. If both sides have the key... how can it be 'secret'? All one would

Re: socketServer questions

2005-10-10 Thread rbt
On Mon, 2005-10-10 at 07:46 -0700, Paul Rubinhttp: wrote: rbt [EMAIL PROTECTED] writes: Instead, for client #i, let that client's key be something like hmac(your_big_secret, str(i)).digest() and the client would send #i as part of the string. How is this different from sending

Re: socketServer questions

2005-10-08 Thread rbt
On Fri, 2005-10-07 at 15:07 -0700, Paul Rubinhttp: wrote: rbt [EMAIL PROTECTED] writes: The server just logs data, nothing else. It's not private or important data... just sys admin type stuff (ip, mac addy, etc.). I just don't want some script kiddie discovering it and trying to 'hack

socketServer questions

2005-10-07 Thread rbt
= str.strip(data) bytes = str(len(data)) public_ip = self.client_address[0] serv_date = time.strftime('%Y-%m-%d', time.localtime()) serv_time = time.strftime('%H:%M:%S', time.localtime()) # Note that 'data; comes from the client. fp = file('/home/rbt

Re: socketServer questions

2005-10-07 Thread rbt
On Fri, 2005-10-07 at 09:17 -0700, Paul Rubinhttp: wrote: 3. How do I keep people from tampering with the server? The clients send strings of data to the server. All the strings start with x and end with y and have z in the middle. Is requiring x at the front and y at the back and z

Re: Finding where to store application data portably

2005-09-22 Thread rbt
On Tue, 2005-09-20 at 23:03 +0100, Tony Houghton wrote: I'm using pygame to write a game called Bombz which needs to save some data in a directory associated with it. In Unix/Linux I'd probably use ~/.bombz, in Windows something like C:\Documents And Settings\user\Applicacation Data\Bombz.

win32 service and time.sleep()

2005-09-20 Thread rbt
minutes with time.sleep(600) and then wakes and tries again. This is when the problem occurs. I can't stop the service while the program is sleeping. When I try, it just hangs until a reboot. Can some suggest how to fix this? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

win32 service and time.sleep()

2005-09-20 Thread rbt
minutes with time.sleep(600) and then wakes and tries again. This is when the problem occurs. I can't stop the service while the program is sleeping. When I try, it just hangs until a reboot. Can some suggest how to fix this? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: appended crontab entries with py script

2005-09-14 Thread rbt
On Tue, 2005-09-13 at 23:18 -0400, Mike Meyer wrote: rbt [EMAIL PROTECTED] writes: How can I safely append a crontab entry to a crontab file progammatically with Python? Well, one way would be to invoke the system crontab utility and use an editor that passes the file to your program

Get Mac OSX Version

2005-09-13 Thread rbt
Is there a similar function to sys.getwindowsversion() for Macs? Many thanks! -- http://mail.python.org/mailman/listinfo/python-list

appended crontab entries with py script

2005-09-13 Thread rbt
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to work across Linux and BSD systems. Any pointers? --

pretty windows installer for py scripts

2005-09-08 Thread rbt
Any recommendations on a windows packager/installer that's free? I need it to allow non-tech users to install some python scripts... you know, Click Next... Click Next... Click Finish... You're Done! and everything just magically works ;) -- http://mail.python.org/mailman/listinfo/python-list

broken links

2005-07-22 Thread rbt
How can I find broken links (links that point to files that do not exist) in a directory and remove them using Python? I'm working on RHEL4 Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: broken links

2005-07-22 Thread rbt
I found it: os.path.exists(path) On Fri, 2005-07-22 at 09:22 -0400, rbt wrote: How can I find broken links (links that point to files that do not exist) in a directory and remove them using Python? I'm working on RHEL4 Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: goto

2005-07-19 Thread rbt
On Tue, 2005-07-19 at 10:02 -0400, George Sakkis wrote: rbt [EMAIL PROTECTED] wrote: On Mon, 2005-07-18 at 12:27 -0600, Steven Bethard wrote: Hayri ERDENER wrote: what is the equivalent of C languages' goto statement in python? Download the goto module: http

Re: goto

2005-07-19 Thread rbt
On Wed, 2005-07-20 at 03:43 +1000, Steven D'Aprano wrote: On Tue, 19 Jul 2005 11:29:58 -0400, rbt wrote: It should not really come as a shock that the same fellow who came up with a brilliant efficient way to generate all permutations (http://tinyurl.com/dnazs) is also in favor

Re: Python scripts wont run - HELP

2005-07-18 Thread rbt
On Mon, 2005-07-18 at 17:22 +0100, John Abel wrote: windozbloz wrote: Bye Bye Billy Bob... Hello All, I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python 2.3.4. I can run three or

Re: goto

2005-07-18 Thread rbt
On Mon, 2005-07-18 at 12:27 -0600, Steven Bethard wrote: Hayri ERDENER wrote: what is the equivalent of C languages' goto statement in python? Download the goto module: http://www.entrian.com/goto/ And you can use goto to your heart's content. And to the horror of all your

Re: goto

2005-07-18 Thread rbt
10 PRINT YOU'RE NOT RIGHT IN THE HEAD. 20 GOTO 10 On Tue, 2005-07-19 at 02:33 +, Leif K-Brooks wrote: rbt wrote: IMO, most of the people who deride goto do so because they heard or read where someone else did. 1 GOTO 17 2 mean,GOTO 5 3 couldGOTO 6 4

Re: all possible combinations

2005-07-15 Thread rbt
Wow. That's neat. I'm going to use it. Thanks! On Thu, 2005-07-14 at 19:52 -0400, Peter Hansen wrote: Bengt Richter wrote: On Thu, 14 Jul 2005 17:10:37 -0400, William Park [EMAIL PROTECTED] wrote: It's a one liner in Python too ;-) print ' '.join([x+y+z+q for s in ['abc'] for x in s

Re: all possible combinations

2005-07-14 Thread rbt
Thanks to all who were helpful... some of you guys are too harsh and cynical. Here's what I came up with. I believe it's a proper combination, but I'm sure someone will point out that I'm wrong ;) groups = [list('abc'),list('abc'),list('abc'),list('abc')] already = [] while 1: LIST = []

all possible combinations

2005-07-13 Thread rbt
Say I have a list that has 3 letters in it: ['a', 'b', 'c'] I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 abaa aaba aaab acaa aaca aaac ... What is the most efficient way to do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: all possible combinations

2005-07-13 Thread rbt
On Thu, 2005-07-14 at 00:47 +1000, Steven D'Aprano wrote: On Wed, 13 Jul 2005 10:21:19 -0400, rbt wrote: Say I have a list that has 3 letters in it: ['a', 'b', 'c'] I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 abaa aaba

Re: all possible combinations

2005-07-13 Thread rbt
On Wed, 2005-07-13 at 10:21 -0400, rbt wrote: Say I have a list that has 3 letters in it: ['a', 'b', 'c'] I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 abaa aaba aaab acaa aaca aaac ... What is the most efficient way to do

Re: all possible combinations

2005-07-13 Thread rbt
On Wed, 2005-07-13 at 11:09 -0400, rbt wrote: On Wed, 2005-07-13 at 10:21 -0400, rbt wrote: Say I have a list that has 3 letters in it: ['a', 'b', 'c'] I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 abaa aaba aaab acaa

breaking out of nested loop

2005-07-12 Thread rbt
What is the appropriate way to break out of this while loop if the for loop finds a match? while 1: for x in xrange(len(group)): try: mix = random.sample(group, x) make_string = ''.join(mix) n = md5.new(make_string) match =

Re: breaking out of nested loop

2005-07-12 Thread rbt
Thanks guys... that works great. Now I understand why sometimes logic such as 'while not true' is used ;) On Tue, 2005-07-12 at 10:51 -0400, Peter Hansen wrote: rbt wrote: What is the appropriate way to break out of this while loop if the for loop finds a match? Define a flag first

Re: Is Python Suitable for Large Find Replace Operations?

2005-06-17 Thread rbt
On Fri, 2005-06-17 at 12:33 +1000, John Machin wrote: OK then, let's ignore the fact that the data is in a collection of Word Excel files, and let's ignore the scale for the moment. Let's assume there are only 100 very plain text files to process, and only 1000 SSNs in your map, so it

Re: Is Python Suitable for Large Find Replace Operations?

2005-06-16 Thread rbt
On Tue, 2005-06-14 at 19:51 +0200, Gilles Lenfant wrote: rbt a crit : Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients

Re: Is Python Suitable for Large Find Replace Operations?

2005-06-16 Thread rbt
On Tue, 2005-06-14 at 19:51 +0200, Gilles Lenfant wrote: rbt a crit : Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients

Re: Is Python Suitable for Large Find Replace Operations?

2005-06-16 Thread rbt
On Tue, 2005-06-14 at 11:34 +1000, John Machin wrote: rbt wrote: Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients. Your

Re: Is Python Suitable for Large Find Replace Operations?

2005-06-16 Thread rbt
On Tue, 2005-06-14 at 19:51 +0200, Gilles Lenfant wrote: rbt a crit : Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients

Re: Is Python Suitable for Large Find Replace Operations?

2005-06-16 Thread rbt
On Tue, 2005-06-14 at 19:51 +0200, Gilles Lenfant wrote: rbt a crit : Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients

Is Python Suitable for Large Find Replace Operations?

2005-06-13 Thread rbt
Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients. Your company has generated its own unique ID numbers to replace the social

Re: Destructive Windows Script

2005-06-06 Thread rbt
Terry Reedy wrote: Dennis Lee Bieber [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My previous facility didn't even accept mil-spec wipes -- all disk drives leaving the facility had to go through a demagnitizer, OT but I am curious: does a metallic case act as a metallic

Re: Destructive Windows Script

2005-06-06 Thread rbt
Mike Meyer wrote: Terry Reedy [EMAIL PROTECTED] writes: On *nix, one could open '/dev/rawdisk' (actual name depends on the *nix build) and write a tracks worth of garbage for as many tracks as there are. I don't how to programmaticly get the track size and number (if there is a standard way

How many threads are too many?

2005-06-05 Thread rbt
This may be a stupid question, but here goes: When designing a threaded application, is there a pratical limit on the number of threads that one should use or is there a way to set it up so that the OS handles the number of threads automatically? I am developing on 32-bit x86 Intel systems

mix up a string

2005-06-05 Thread rbt
What's the best way to take a string such as 'dog' and mix it up? You know, like the word jumble in the papers? ODG. I thought something like mix = random.shuffle('dog') would do it, but it won't. Any tips? Thanks, rbt -- http://mail.python.org/mailman/listinfo/python-list

Re: mix up a string

2005-06-05 Thread rbt
Reinhold Birkenfeld wrote: rbt wrote: What's the best way to take a string such as 'dog' and mix it up? You know, like the word jumble in the papers? ODG. I thought something like mix = random.shuffle('dog') would do it, but it won't. Any tips? py def shuffled(s): ... l = list(s

Destructive Windows Script

2005-06-05 Thread rbt
How easy or difficult would it be for a computer forensics expert to recover data that is overwritten in this manner? This is a bit off-topic for comp.lang.python, but I thought some here would have some insight into this. Warning: **This code is destructive**. Do not run it unless you fully

Re: Destructive Windows Script

2005-06-05 Thread rbt
Roose wrote: My guess would be: extremely, extremely easy. Since you're only writing 30 bytes for each file, the vast majority of the data will still be present on disk, just temporarily inaccessible because of the del command. And more than likely it will be possible to recover 100% if

Re: Destructive Windows Script

2005-06-05 Thread rbt
Chris Lambacher wrote: The reason they are slow and tedious is that they need to write to every byte on the disk. Depending on the size of the disk, there may be a lot of data that needs to be written, and if they are older computers, write speed may not be particularly fast. OK, I accept

Re: Two questions

2005-06-02 Thread rbt
Peter Hansen wrote: Philosophy not entirely aside, you should note that object code in any language can easily be reverse-engineered in the same way, with the only difference being the degree of ease involved. If the code is worth enough to someone that they are willing to risk violating

Re: Information about Python Codyng Projects Ideas

2005-06-01 Thread rbt
Rob Cowie wrote: Ha, I've just headed over here to ask the same thing! Any good ideas not listed on the wiki? I too am taking a Masters in Computer Science, however my first degree was not purely CS - mostly microbiology, so I'm not yet what one would call an expert Cheers So

Calculating Inflation, retirement and cost of living adjustments over 30 years

2005-06-01 Thread rbt
Is this mathematically correct? def inflation(): start = int(str.strip(raw_input(How much money do you need each month at the start of retirement: ))) inflation = float(str.strip(raw_input(What will inflation average over the next 30 years(.03, .04, etc): ))) for x in

Re: cpu usage limit

2005-05-27 Thread rbt
mf wrote: Hi. My problem: How can I make sure that a Python process does not use more that 30% of the CPU at any time. I only want that the process never uses more, but I don't want the process being killed when it reaches the limit (like it can be done with resource module). Can you

Re: cpu usage limit

2005-05-27 Thread rbt
[EMAIL PROTECTED] wrote: rbt [EMAIL PROTECTED] wrote: mf wrote: Hi. My problem: How can I make sure that a Python process does not use more that 30% of the CPU at any time. I only want that the process never uses more, but I don't want the process being killed when it reaches the limit (like

  1   2   3   >