Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Lie Ryan
Richard Lovely wrote: > 2009/6/24 Dinesh B Vadhia : >> Hi Vince >> >> That's terrific! Once a string is compressed with gzip.zlib does it make a >> difference whether it is stored it in a TEXT or BLOB column? >> >> Dinesh >> >> >>From the MySQL language reference: > """A BLOB is a binary large obj

[Tutor] Fwd: Problems with parameter queries

2009-06-24 Thread Richard Lovely
(oops... forgot to reply-all) -- Forwarded message -- From: Richard Lovely Date: 2009/6/25 Subject: Re: [Tutor] Problems with parameter queries To: Eduardo Vieira 2009/6/24 Eduardo Vieira : > Hello, I am accessing a Pervasive SQL data source using odbc and I'm > having this tr

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Richard Lovely
2009/6/24 Dinesh B Vadhia : > Hi Vince > > That's terrific!  Once a string is compressed with gzip.zlib does it make a > difference whether it is stored it in a TEXT or BLOB column? > > Dinesh > > >From the MySQL language reference: """A BLOB is a binary large object that can hold a variable amount

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Alan Gauld
"Dinesh B Vadhia" wrote I want to pickle (very long) strings and save them in a sqlite db. Why? Why not just store the string in the database? If that turns out to be a problem then think about other options - like splitting it into chunks say? But until you know you have a problem don't

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
Ok -- realized my "solution" incorrectly strips white space from multiword strings: > Out[92]: ['a2345b.', 'a45453b.a325643b.a435643b.'] > So here are some more gymnastics to get the correct result: In [105]: newlist Out[105]: ['a2345b.', '|', 'a45453b.', 'a325643b.', 'a435643b.', '|'] In [109]

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
As usual, Kent Johnson has swooped in an untangled the mess with a clear explanation. By the time a regex gets this complicated, I typically start thinking of ways to simplify or avoid them altogether. Below is the code I came up with. It goes through some gymnastics and can surely stand improvem

Re: [Tutor] re module / separator

2009-06-24 Thread Kent Johnson
On Wed, Jun 24, 2009 at 2:24 PM, Tiago Saboga wrote: > Hi! > > I am trying to split some lists out of a single text file, and I am > having a hard time. I have reduced the problem to the following one: > > text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b." > > Of this line of text, I wan

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Dinesh B Vadhia
Hi Vince That's terrific! Once a string is compressed with gzip.zlib does it make a difference whether it is stored it in a TEXT or BLOB column? Dinesh From: vince spicer Sent: Wednesday, June 24, 2009 10:49 AM To: Dinesh B Vadhia Cc: tutor@python.org Subject: Re: [Tutor] string pickling

Re: [Tutor] re module / separator

2009-06-24 Thread Tiago Saboga
Serdar Tumgoren writes: > Hey Tiago, > >> text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b." >> >> Of this line of text, I want to take out strings where all words start >> with a, end with "b.". But I don't want a list of words. I want that: >> >> ["a2345b.", "a45453b. a325643b. a4356

Re: [Tutor] Help with photo wall

2009-06-24 Thread Luke Paireepinart
Jacob Mansfield wrote: thank you Luke, It's a bit more complicated than that, all the images are in one massive jpg file similar to those in http://cdn.nhl.com/ducks/images/upload/2008/06/FanPhotos3.jpg So they're not lined up? they overlap? Do they have to be in one massive jpg? Do they hav

[Tutor] Problems with parameter queries

2009-06-24 Thread Eduardo Vieira
Hello, I am accessing a Pervasive SQL data source using odbc and I'm having this trouble: import dbi import odbc # the first execute works pnumber = '09F153' wh = '00' qty = 3 myconn = odbc.odbc('DSN=MKPT01') mycursor = myconn.cursor() mycursor.execute(""" SELECT "INVENTORY"."CODE", "INVENTORY"."

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
apologies -- I just reread your post and appears you also want to capture the dot after each "b" ( "b." ) In that case, you need to update the pattern to match for the dot. But because the dot is itself a metacharacter, you have to escape it with a backslash: In [23]: re.findall(r'a\w+b\.',text)

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
Hey Tiago, > text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b." > > Of this line of text, I want to take out strings where all words start > with a, end with "b.". But I don't want a list of words. I want that: > > ["a2345b.", "a45453b. a325643b. a435643b."] > Are you saying you want a

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Kent Johnson
On Wed, Jun 24, 2009 at 1:17 PM, Dinesh B Vadhia wrote: > I want to pickle (very long) strings and save them in a sqlite db.  The plan > is to use pickle dumps() to turn a string into a pickle object and store it > in sqlite.  After reading the string back from the sqlite db, use pickle > loads() t

Re: [Tutor] puzzling for-loop behavior

2009-06-24 Thread Yash
That helps a lot. It was stupid of me to not compare the output from the two functions. The second for loop is actually skiiping over some of the values and hence it takes longer to run when the "plst" is generated. On Wed, Jun 24, 2009 at 8:16 AM, Luke Paireepinart wrote: > Yash wrote: >> >> Hel

[Tutor] re module / separator

2009-06-24 Thread Tiago Saboga
Hi! I am trying to split some lists out of a single text file, and I am having a hard time. I have reduced the problem to the following one: text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b." Of this line of text, I want to take out strings where all words start with a, end with "b.".

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread vince spicer
Pickle is more for storing complex objects (arrays, dict, etc). pickling a string makes it bigger. I have stored large text chunks in text and/or blob columns compressed with gzip.zlib.compress and extracted with gzip.zlib.decompress Comparison: import cPickle as Pickle import gzip x = "asdfasd

[Tutor] string pickling and sqlite blob'ing

2009-06-24 Thread Dinesh B Vadhia
I want to pickle (very long) strings and save them in a sqlite db. The plan is to use pickle dumps() to turn a string into a pickle object and store it in sqlite. After reading the string back from the sqlite db, use pickle loads() to turn back into original string. - Is this a good approac

Re: [Tutor] Help with photo wall

2009-06-24 Thread Jacob Mansfield
thank you Luke, It's a bit more complicated than that, all the images are in one massive jpg file similar to those in http://cdn.nhl.com/ducks/images/upload/2008/06/FanPhotos3.jpg also the joystick is a usb module so I didn't think that would work. with regards to the wasd keys there is a glitch th

Re: [Tutor] Help with photo wall

2009-06-24 Thread Luke Paireepinart
bob gailer wrote: Please start a new thread with a relevant topic rather than adding to an existing thread. seconded hello all, I am currently making a birthday prezzie for someone (deadline is Thursday night). the basic idea is a wall of photos that you can move about to view different one

Re: [Tutor] Help with photo wall

2009-06-24 Thread bob gailer
Please reply-all so a copy goes to the list. Jacob Mansfield wrote: I've all ready got most of the code just need help with the sound and joystick 2009/6/24 bob gailer mailto:bgai...@gmail.com>> Please start a new thread with a relevant topic rather than adding to an existing thread.

Re: [Tutor] Help with photo wall

2009-06-24 Thread bob gailer
Please start a new thread with a relevant topic rather than adding to an existing thread. hello all, I am currently making a birthday prezzie for someone (deadline is Thursday night). the basic idea is a wall of photos that you can move about to view different ones using a joystick and press

Re: [Tutor] puzzling for-loop behavior

2009-06-24 Thread Luke Paireepinart
Yash wrote: Hello, I am a newbie to python. I am trying to practice writing a code in python and am trying to write a function to generate prime numbers using sieve of Eratosthenes. (code follows at the end of mail) The way it is coded, if I change the for loop over "j" from for j in range( (2*i

[Tutor] AUTO: James D Mcclatchey is out of the office. (returning 06/29/2009)

2009-06-24 Thread James D Mcclatchey
I am out of the office until 06/29/2009. I will respond to your message when I return. Note: This is an automated response to your message "Tutor Digest, Vol 64, Issue 113" sent on 6/24/09 3:00:02. This is the only notification you will receive while this person is away. *IMPORTANT NOTICE:

Re: [Tutor] reading and processing xml files with python

2009-06-24 Thread Jacob Mansfield
hello all, I am currently making a birthday prezzie for someone (deadline is Thursday night). the basic idea is a wall of photos that you can move about to view different ones using a joystick and press the joystick button to hear a roughly five second commentary that is individual for each phot

[Tutor] puzzling for-loop behavior

2009-06-24 Thread Yash
Hello, I am a newbie to python. I am trying to practice writing a code in python and am trying to write a function to generate prime numbers using sieve of Eratosthenes. (code follows at the end of mail) The way it is coded, if I change the for loop over "j" from for j in range( (2*i*(i + 1)), np,