I have come over a strange problem regarding exceptions
This is my code:
try:
#some operation
except Exception, info:
#some message
except:
#??
When executing my code, I get to the last block here. This
I find rather strange, because I thought Exception would catch
all exceptions. But this
I have to lists, A and B, that may, or may not be equal. If they are not
identical, I want the output to be three new lists, X,Y and Z where X has
all the elements that are in A, but not in B, and Y contains all the
elements that are B but not in A. Z will then have the elements that are
in
I use xml.dom.minidom to parse some xml, but when input
contains some specific caracters(æ, ø and å), I get an
UnicodeEncodeError, like this:
UnicodeEncodeError: 'ascii' codec can't encode character
u'\xe6' in position 604: ordinal not in range(128).
How can I avoid this error?
All help much
On 2005-09-05, Fredrik Lundh [EMAIL PROTECTED] wrote:
Odd-R. wrote:
I use xml.dom.minidom to parse some xml, but when input
contains some specific caracters(æ, ø and å), I get an
UnicodeEncodeError, like this:
UnicodeEncodeError: 'ascii' codec can't encode character
u'\xe6' in position 604
If input is ['red','blue'],
list1 is [ {'primarycolor':'red', 'secondarycolor':'burgundee'},
{'primarycolor':'red', 'secondarycolor':'wine'},
{'primarycolor':'yellow','secondarycolor':'plain'},
{'primarycolor':'blue','secondarycolor':'ocean'}]
I use the following piece of code to contact a webservice,
and read a wsdl file.
from SOAPpy import WSDL
from SOAPpy import URLopener
url= ' http://someserver/somewebservice
url1 = URLopener.URLopener(username='user',passwd='pass')
server=WSDL.Proxy(url1.open(url))
This yields no errors, and
On 2005-07-26, Duncan Booth [EMAIL PROTECTED] wrote:
rx1=re.compile(r\b\d{4}(?:-\d{4})?,)
rx1.findall(1234,-,4567,)
['1234,', '-,', '4567,']
Thanks all for good advice. However this last expression
also matches the first four digits when the input is more
than four digits. To
Input is a string of four digit sequences, possibly
separated by a -, for instance like this
1234,-,4567,
My regular expression is like this:
rx1=re.compile(r\A(\b\d\d\d\d,|\b\d\d\d\d-\d\d\d\d,)*\Z)
When running rx1.findall(1234,-,4567,)
I only get the last match as the
I have this list:
[{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}]
All the dictionaries of this list are of the same form, and all the oids
are distinct. If I have an oid and the list, how is the simplest way of
getting the dictionary that holds this oid?
Thanks in
On 2005-07-22, John Machin [EMAIL PROTECTED] wrote:
Odd-R. wrote:
I have this list:
[{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}]
All the dictionaries of this list are of the same form, and all the oids
are distinct. If I have an oid and the list, how
I have a dictionary, and I want to convert it to a tuple,
that is, I want each key - value pair in the dictionary
to be a tuple in a tuple.
If this is the dictionary {1:'one',2:'two',3:'three'},
then I want this to be the resulting tuple:
((1,'one'),(2,'two'),(3,'three')).
I have been trying for
11 matches
Mail list logo