Re: Extract value and average

2009-06-09 Thread Glauco
for l in file('file.txt','r') if ' DIHED ' in l ] mean = sum(vals) / len(vals) print vals print mean Glauco -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools question

2009-05-14 Thread Glauco
Neal Becker ha scritto: Is there any canned iterator adaptor that will transform: in = [1,2,3] into: out = [(1,2,3,4), (5,6,7,8),...] That is, each time next() is called, a tuple of the next N items is returned. http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-

Re: string in files

2008-12-31 Thread Glauco
Steven D'Aprano ha scritto: On Tue, 30 Dec 2008 11:53:17 +0100, Glauco wrote: thanks brother i mean how do i particularly assign (u = this) (y = is) in the strings up there. i have been able to split strings with any character sign. If i'm

Re: string in files

2008-12-30 Thread Glauco
#x27;is'), ('t', 'a'), ('fi', 'coding'), ('fo', 'python'), ('first', 'this')] In [8]: dict(m.groupdict().items()) Out[8]: {'fi': 'coding', 'first': 'this', 'fo': 'python', 'second': 'is', 'si': 'group', 't': 'a'} Glauco -- http://mail.python.org/mailman/listinfo/python-list

Re: File to dict

2007-12-07 Thread Glauco
david ha scritto: > On Fri, 07 Dec 2007 16:46:56 +0100, Glauco wrote: > >> [EMAIL PROTECTED] ha scritto: >>> Hello everyone, >>> >>> I have written this small utility function for transforming legacy file >>> to Python dict: >>> >

Re: File to dict

2007-12-07 Thread Glauco
okup( domain ): if not cache: cache = dict( [map( lambda x: x.strip(), x.split(':')) for x in open('/etc/virtual/domainowners','r').readlines()]) return cache.get(domain) Glauco -- http://mail.python.org/mailman/listinfo/python-list

EOF occurred in violation of protocol

2006-01-17 Thread Glauco
: (8, 'EOF occurred in violation of protocol') I'm in trouble because i've tryed some workaround on httplib.py and socket.py but they don't work never. Some soggestion or workaround for bypass this problem? Thank you anyway. Glauco -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary, keys and alias

2005-07-19 Thread Glauco
Steven D'Aprano wrote: > On Mon, 18 Jul 2005 12:17:37 +0200, Glauco wrote: > > >>I want to insert a concept of alias in a dict_based class. >> >>The idea is to have a facoltative name in the same dict that correspond >>at the same value. With

Dictionary, keys and alias

2005-07-18 Thread Glauco
;a', 'b') print mydict {'a':1, 'b':1} mydict['b'] = 2 print mydict {'a':2, 'b':2} The only idea i have is to implement two dictionary one for convert name, alias in two keys with the same value (eg.numeric) in the firs

Re: psycopg simplest problem

2005-07-08 Thread Glauco
Gerhard Haering wrote: > On Fri, Jul 08, 2005 at 04:23:50PM +0200, Glauco wrote: > >>[...] >>My problem is to do a middle layer over pycopg for eliminate type >>casting problem in postgres in all direction. >> >>i've resolved this doing a C extension in p

psycopg simplest problem

2005-07-08 Thread Glauco
(myint, mytext, maydate) values (%s,%s,%s);""" % (myvalue1, myvalue2, myvalue3) without all time check for none, empty string and so on... I've seen API of psycopg and s

Re: Multiple "cmp"s chained one after another

2005-05-16 Thread Glauco Silva
You can try this : >>> l = [(2001, 5, 2),(2111,3,3),(1984, 3, 1), (2001, 1, 1)] >>> l.sort(lambda x = l[0],y = l[1] : cmp((x[1],x[2]),(y[1],y[2]))) - Original Message - From: "Volker Grabsch" <[EMAIL PROTECTED]> To: Sent: Saturday, May 14, 2005 7:09 AM Subject: Multiple "cmp"s chained on

Re: problem in the compiler ?

2005-05-05 Thread Glauco Silva
) self.myButton.pack() ... self.myButton.invoke('C1') - - Original Message - From: "Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> To: "Glauco Silva" <[EMAIL PROTECTED]>; Sent: Wednes

Re: problem in the compiler ?

2005-05-03 Thread Glauco Silva
#x27; : MyClass() when i call in the console like this: C:\python MyClass.py if i using in the __init__ this : Pmw.RadioSelect(command = self.Function) so the string "Enter in the Function" is print Thank you Glauco - Original Message - From: "Scott

Re: problem in the compiler ?

2005-05-03 Thread Glauco Silva
27;Function' is call. And i don´t want this. What´s wrong ? Thank you Glauco - Original Message - From: "Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> To: "Glauco Silva" <[EMAIL PROTECTED]>; Sent: Monday, May 02, 2005 8:50 PM Subject: RE: problem in th

problem in the compiler ?

2005-05-02 Thread Glauco Silva
when i creat a RadioButton and put a command = self.Function , this function is called in the creation of RadioButton. It´s right this or it´s wrong ? Thank you Glauco  No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.1 - Release

How can i solve this problem with py2exe ?

2005-04-27 Thread Glauco Silva
'],      )   My PYTHONPATH = C:\Python23;C:\promed2.0\vtk-windows;C:\promed2.0\python   My dir: ## promed2.0/          setup.cfg               setup.py   icons/             docs/                python/                           MyMainModule.py                vtk-window/                     

Problem using py2exe

2005-04-18 Thread Glauco Silva
.0\python   My dir: ## promed2.0/          setup.cfg               setup.py   icons/                 docs/                python/                           MyMainModule.py                vtk-window/                            vtkpython.py                            vtkpythontk.py                               vtk.pth                            vtkCommon.dll                            vtkCommonPython.dll                            vtkCommonTCL.dll                                       ...   vtk/ ###   OS: win 2K Python ver: 2.3.5py2exe ver: 0.5.4   How can i solve this problem?   Thanks Glauco No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.16 - Release Date: 18/4/2005 -- http://mail.python.org/mailman/listinfo/python-list

problem with py2exe !

2005-04-15 Thread Glauco Silva
0\python   My dir: ## promed2.0/          setup.cfg               setup.py   icons/                 docs/                python/                           MyMainModule.py                vtk-window/                            vtkpython.py                            vtkpythontk.py                               vtk.pth                            vtkCommon.dll                            vtkCommonPython.dll                            vtkCommonTCL.dll                                       ...   vtk/ ###   OS: win 2K Python ver: 2.3.5py2exe ver: 0.5.4   How can i solve this problem?   Thanks Glauco   No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.11 - Release Date: 14/4/2005 -- http://mail.python.org/mailman/listinfo/python-list

Problem in Dictionaries

2005-03-01 Thread Glauco Silva
hundred twenty nine", 50: "fifty"}   But i need dict sort : { 50: "fifty", 129: "a hundred twenty nine"}   How can i do this ?   Thanks, Glauco Buzini da Costa Silva -- http://mail.python.org/mailman/listinfo/python-list