Re: Help counting the total number of dictionaries inside a list that contain a specified key value

2008-08-12 Thread Jon Bowlas
' I'm afraid I can't use Peters suggestion as I'm using python 2.3 and it doesn't have the collection module. Thanks anyway. Cheers Jon 2008/8/12 Jon Bowlas <[EMAIL PROTECTED]>: > Many thanks for all your reponses, much appreciated. > > I'll get back t

Re: Help counting the total number of dictionaries inside a list that contain a specified key value

2008-08-12 Thread Jon Bowlas
Many thanks for all your reponses, much appreciated. I'll get back to you on which is the best for me. BTW - yes John thats exactly what I wanted. Cheers Jon Jon Bowlas wrote: > For example I'd like to kow how many dictionaries there are with a > level 1, 2 , 23 & 3 e

Help counting the total number of dictionaries inside a list that contain a specified key value

2008-08-12 Thread Jon Bowlas
Hi All, I have the following list containing dictionaries and I would like to be able to count the total number of dictionaries I have that contain a certain value set for the 'level' key: [{'mod_title': u'Introduction to Human Anatomy', 'level': u'1', 'modcode': u'ANAT1003', 'deptleveltext': u''

ftplib returns EOFError

2008-05-19 Thread Jon Bowlas
Hi All, I've written a little method to connect to an ftpserver which works well, however when I send a file using this ftp connection oddly I _sometimes_ get returned an EOFError from ftplib.getline even though my file is actually transferred. Here's my script: def uploadViaFtp(self, file,

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
string or buffer, NoneType found > Jon Bowlas wrote: > >> I wrote this script in Zope some time ago and it worked for a while, but >> now I'm getting the following error: >> TypeError: coercing to Unicode: need string or buffer, NoneType found >> >> Here'

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Ahh, that did it, thanks very much. Jon - Original Message - From: <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: Sent: Thursday, July 27, 2006 11:19 AM Subject: Re: coercing to Unicode: need string or buffer, NoneType found > > Jon Bowlas wrote: > >

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
ode: need string or buffer, NoneType found > Jon Bowlas enlightened us with: >> I wrote this script in Zope some time ago and it worked for a while, >> but now I'm getting the following error: >> TypeError: coercing to Unicode: need string or buffer, NoneType >&

coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Hi listers, I wrote this script in Zope some time ago and it worked for a while, but now I'm getting the following error: TypeError: coercing to Unicode: need string or buffer, NoneType found Here's my script: results = context.module_retriever().tuples() # call to ZSQLMethod converted = [] for

RE: looping list problem

2005-08-16 Thread Jon Bowlas
Many thanks for your help, worked a treat Jon -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 17:25 To: python-list@python.org Subject: RE: looping list problem Jon Bowlas wrote: > Incidentally I'm doing this

RE: looping list problem

2005-08-16 Thread Jon Bowlas
uld ignore it and move onto the next one, but it doesn't seem to do anything. Any help would be appreciated. Incidentally I'm doing this in zope. Jon -----Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Otten Sent: 16 August 2005 14:41 To

RE: looping list problem

2005-08-16 Thread Jon Bowlas
5: Yield statements are not allowed. Any ideas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: 16 August 2005 13:44 To: python-list@python.org Subject: Re: looping list problem Jon Bowlas wrote: > attobject = context.get_

looping list problem

2005-08-16 Thread Jon Bowlas
HI all, I'm fairly new to python and programming in general so I was hoping someone here may be able to help me. Let me explain what the problem I'm having is: I am trying to parse the XML of an attributes object I created, this object has the structure outlined below. Everything is ok on the par