On Thu, 2006-01-26 at 09:24, Johhny wrote: > Hello, > > I am currently trying to write some scripts to get information from the > xmlrpc for redhat network. One of the issues I am having is trying to > strip off the special characters in the hash that is returned. Here is > an example of the information returned within the hash : > > ===SNIP=== > {'errata_update_date': '2005-12-06', 'errata_topic': 'Updated > libc-client packages that fix a buffer overflow issue are > now\navailable.\n\nThis update has been rated as having moderate > security impact by the Red\nHat Security Response Team.', > > [...] > > What I had attempted to do is use the replace() function but it > consistantly comes up with the following errors: > > Traceback (most recent call last): > File "rhn_errata.py", line 63, in ? > errata_package = errata_package.strip('\n','') > AttributeError: 'dict' object has no attribute 'strip' > > where errata_package is JUST the errata_topic hash value.
errata_package is obviously not just the errata_topic hash value, because that would be a string, and python for some reason seems to believe that errata_package is a dictionary. Also note that once you correct that problem, python will complain that strip() doesn't take 2 parameters, since you actually mean replace(). -Carsten -- http://mail.python.org/mailman/listinfo/python-list