Re: splitting a large dictionary into smaller ones

2009-03-22 Thread odeits
On Mar 22, 7:32 pm, per wrote: > hi all, > > i have a very large dictionary object that is built from a text file > that is about 800 MB -- it contains several million keys.  ideally i > would like to pickle this object so that i wouldnt have to parse this > large file to compute the dictionary ev

Re: Threads not Improving Performance in Program

2009-03-19 Thread odeits
On Mar 19, 9:50 am, Ryan Rosario wrote: > I have a parser that needs to process 7 million files. After running > for 2 days, it had only processed 1.5 million. I want this script to > parse several files at once by using multiple threads: one for each > file currently being analyzed. > > My code i

Re: converting pipe delimited file to fixed width

2009-03-19 Thread odeits
On Mar 19, 8:51 am, digz wrote: > Hi, > I am trying to convert a | delimited  file to fixed width by right > padding with spaces, Here is how I have written the program , just get > the feeling this can be done in a much better ( python functional ) > way rather than the procedural code i have bel

Re: Input data from .txt file and object array problem

2009-03-13 Thread odeits
> > >S> information from database.txt. > > > I guess you want to put them in a list. Then use > >                 objList.append(temp) > > here and > > objList = [] before the loop. > > > >S> How can I do that?  I am a beginner to Python.

Re: converting a string to a function parameter

2009-03-13 Thread odeits
On Mar 13, 12:52 am, koranthala wrote: > Hi, >     Is it possible to convert a string to a function parameter? > Ex: > str = 'True, type=rect, sizes=[3, 4]' > and I should be able to use it as: > test(convert(str)) and the behaviour should be same as calling test > with those values : > i.e. test(

Re: Input data from .txt file and object array problem

2009-03-12 Thread odeits
On Mar 12, 5:03 am, SamuelXiao wrote: > I want to input data by using pickle > First of all, I have a database.txt > The content is like: > > AAA,aaalink > BBB,bbblink > CCC,ccclink > ...,... > > AAA,BBB,CCC is Language name, and aaalink,bbblink,ccclink is their > respective link. > I want to stor

Re: How to extract some text?

2009-03-09 Thread odeits
On Mar 8, 3:50 pm, Oltmans wrote: > On Mar 9, 3:37 am, Chris Rebert wrote: > > > Learn about the methods of the string class > > (str):http://docs.python.org/library/stdtypes.html#id4 > > > You'll probably be most interested in .split() > > OK, thanks I got it. I was trying to use Regex but .spl

Re: Help cleaning up some code

2009-03-09 Thread odeits
On Mar 9, 1:06 am, Dennis Lee Bieber wrote: > On Sun, 8 Mar 2009 19:07:08 -0700 (PDT), odeits > declaimed the following in gmane.comp.python.general: > > > > > i get this error when running that query: > > > sqlite3.OperationalError: LIMIT clause should c

Re: Help cleaning up some code

2009-03-08 Thread odeits
On Mar 8, 12:31 pm, Dennis Lee Bieber wrote: > On Sat, 7 Mar 2009 23:07:55 -0800 (PST), odeits > declaimed the following in gmane.comp.python.general: > > > > > > > For those of you who asked about the SQL the full function is here. > > The connection is to a sql

Re: Help cleaning up some code

2009-03-08 Thread odeits
On Mar 8, 11:31 am, Dennis Lee Bieber wrote: > On Sat, 7 Mar 2009 23:07:55 -0800 (PST), odeits > declaimed the following in gmane.comp.python.general: > > > > > > > For those of you who asked about the SQL the full function is here. > > The connection is to a sql

Re: Help cleaning up some code

2009-03-08 Thread odeits
On Mar 8, 4:48 am, "andrew cooke" wrote: > odeits wrote: > > On Mar 7, 1:07 pm, Scott David Daniels wrote: > >> odeits wrote: > >> > I am looking to clean up this code... any help is much appreciated. > >> > Note: It works just fine, I just th

Re: Help cleaning up some code

2009-03-07 Thread odeits
On Mar 7, 10:58 pm, odeits wrote: > On Mar 7, 1:07 pm, Scott David Daniels wrote: > > > > > odeits wrote: > > > I am looking to clean up this code... any help is much appreciated. > > > Note: It works just fine, I just think it could be done cleaner. > >

Re: Help cleaning up some code

2009-03-07 Thread odeits
On Mar 7, 1:07 pm, Scott David Daniels wrote: > odeits wrote: > > I am looking to clean up this code... any help is much appreciated. > > Note: It works just fine, I just think it could be done cleaner. > > > The result is a stack of dictionaries. the query returns up to

Help cleaning up some code

2009-03-06 Thread odeits
I am looking to clean up this code... any help is much appreciated. Note: It works just fine, I just think it could be done cleaner. The result is a stack of dictionaries. the query returns up to STACK_SIZE ads for a user. The check which i think is very ugly is putting another contraint saying th

Re: How to replace the two last digits from an xml file?

2009-03-06 Thread odeits
On Mar 6, 3:31 pm, odeits wrote: > On Mar 6, 11:53 am, awel wrote: > > > > > Hi, > > > I am trying to get a value from an xml file, increment it by 1, > > replace by the new value and write another xml with the new value > > inside. > > > I have fo

Re: How to replace the two last digits from an xml file?

2009-03-06 Thread odeits
On Mar 6, 11:53 am, awel wrote: > Hi, > > I am trying to get a value from an xml file, increment it by 1, > replace by the new value and write another xml with the new value > inside. > > I have found this code to get the line and it works but I have to do > everything manualy: > > import re > lin

Re: Pickle Problem

2009-03-03 Thread odeits
On Mar 3, 4:16 am, Fab86 wrote: > Thanks, this seems like a simpler way to do it. > > I plan on recording 200 values to this file from the outcome of 200 > Yahoo searches. Is there any type of loop I can make to do this or do > I have to have a line like "print >> f, res1.total_results_available"

Re: how to find all completely connected sub-graphs?

2009-03-03 Thread odeits
On Mar 2, 11:26 pm, Hyunchul Kim wrote: > Dear Odeits, > > Yes, I meant directly connected to each other. > > Thanks. > > Hyunchul > > odeits wrote: > > On Mar 2, 10:35 pm, Hyunchul Kim wrote: > > >> Hi, all, > > >> How can I find

Re: how to find all completely connected sub-graphs?

2009-03-03 Thread odeits
On Mar 3, 12:07 am, Andre Engels wrote: > On Tue, Mar 3, 2009 at 7:35 AM, Hyunchul Kim wrote: > > How can I find all "completely connected subgraphs" in a graph when node and > > edge data are available? > > > "completely connected subgraph" is a group, all members of which are > > connected to e

Re: how to find all completely connected sub-graphs?

2009-03-02 Thread odeits
On Mar 2, 10:35 pm, Hyunchul Kim wrote: > Hi, all, > > How can I find all "completely connected subgraphs" in a graph when node > and edge data are available? > > "completely connected subgraph" is a group, all members of which are > connected to each other. > > Thanks, > > Hyunchul Do you mean a

Re: Looking for a General Method to Configure Tkinter Widgets

2009-03-02 Thread odeits
On Mar 2, 7:14 am, "W. eWatson" wrote: > I'm modifying a Tkinter Python program that uses hard coded initial values > for several widgets. For example, latitude = 40. My plan is to put the names > and values for configuration purposes into a file. For example, a pseudo > statement like the one jus

Re: removing duplication from a huge list.

2009-02-27 Thread odeits
On Feb 27, 1:18 am, Stefan Behnel wrote: > bearophileh...@lycos.com wrote: > > odeits: > >> How big of a list are we talking about? If the list is so big that the > >> entire list cannot fit in memory at the same time this approach wont > >> work e.g. removi

Re: String search

2009-02-27 Thread odeits
On Feb 27, 2:17 am, "Gabriel Genellina" wrote: > En Fri, 27 Feb 2009 07:33:44 -0200, pranav escribió: > > > Greeting fellow pycoders, > > > I have a script that browses large codes and replaces certain text > > with some other text. Of lately i observed an issue.Some of the > > original text were

Re: Delete all items in the list

2009-02-26 Thread odeits
On Feb 26, 3:05 am, Clarendon wrote: > Hi. This must be a simple command but I just can't find it in the > Phthon manual. How do I delete all items with a certain condition from > a list? For instance: > > L=['a', 'b', 'c', 'a'] > > I want to delete all 'a's from the list. > But if L.remove('a') o

Re: removing duplication from a huge list.

2009-02-26 Thread odeits
On Feb 26, 9:15 pm, Chris Rebert wrote: > On Thu, Feb 26, 2009 at 8:49 PM, Benjamin Peterson > wrote: > > Shanmuga Rajan gmail.com> writes: > > >> f any one suggests better solution then i will be very happy.Advance thanks > > for any help.Shan > > > Use a set. > > To expand on that a bit: > >

Re: How to open a remote file using python.

2009-02-22 Thread odeits
On Feb 22, 9:02 pm, "venutaurus...@gmail.com" wrote: > On Feb 23, 9:25 am, MRAB wrote: > > > > > venutaurus...@gmail.com wrote: > > > Hello all, > > >            I am writing an application where I need to open a shared > > > file on a remote machine using python script. I tried using the > > > f

Re: count secton of data in list

2009-02-21 Thread odeits
On Feb 20, 3:45 pm, Emile van Sebille wrote: > brianrpsgt1 wrote: > > > def step1(val): > >        data2_row = [] > > >     for d1r in data1_row: > >         if d1r[1] >= val: > >             switch = 0 > >             data2_row = d1r[0],d1r[1],d1r[2],switch > >                data2_row.append([d1

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread odeits
On Feb 21, 2:24 pm, rdmur...@bitdance.com wrote: > odeits wrote: > > On Feb 21, 12:47=A0am, "Gabriel Genellina" > > wrote: > > > En Sat, 21 Feb 2009 01:14:02 -0200, odeits escribi=F3: > > > > > On Feb 15, 11:31=A0pm, odeits wrote: > > &g

Re: Pythonic way to determine if one char of many in a string

2009-02-21 Thread odeits
On Feb 21, 12:47 am, "Gabriel Genellina" wrote: > En Sat, 21 Feb 2009 01:14:02 -0200, odeits escribió: > > > > > On Feb 15, 11:31 pm, odeits wrote: > >> It seems what you are actually testing for is if the intersection of > >> the two sets is not

Re: Changing the Image on a button

2009-02-20 Thread odeits
On Feb 17, 7:14 am, John Posner wrote: >  >> > Try this change: >  >> > >  >> >   from: btn.configure(image = None) >  >> >     to: img1.blank() >  >> > >  >> >  >> This does in fact clear the image out, however it isn't causing the >  >> text to display... Do i have have to create a new button an

Re: Pythonic way to determine if one char of many in a string

2009-02-20 Thread odeits
On Feb 15, 11:31 pm, odeits wrote: > On Feb 15, 9:56 pm, Chris Rebert wrote: > > > > > On Sun, Feb 15, 2009 at 9:17 PM,   wrote: > > > I need to test strings to determine if one of a list of chars is in the > > > string. A simple example would be to test stri

Re: Changing the Image on a button

2009-02-16 Thread odeits
On Feb 16, 8:40 am, John Posner wrote: >  >> from Tkinter import * >  >> >  >> def do(): >  >>     btn.configure(image = None) >  >> >  >> root = Tk() >  >> img1 = PhotoImage(file="bacon.gif") >  >> >  >> btn = Button(image = img1, command = do, text = "hello" ) >  >> btn.img = img1 >  >> btn.pack

Re: Pythonic way to determine if one char of many in a string

2009-02-15 Thread odeits
On Feb 15, 9:56 pm, Chris Rebert wrote: > On Sun, Feb 15, 2009 at 9:17 PM,   wrote: > > I need to test strings to determine if one of a list of chars is in the > > string. A simple example would be to test strings to determine if they have > > a vowel (aeiouAEIOU) present. > > > I was hopeful that

Changing the Image on a button

2009-02-15 Thread odeits
I want to be able to toggle if the button has an image or text. For some reason the following code gets the button to have an image but when i push the button i expect the image to go away but it does not. Am I missing something? from Tkinter import * def do(): btn.configure(image = None) r