Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #110494
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | dieter <dieter@handshake.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: I seem to be creating a dict that I cannot access the keys of |
| Date | Sat, 25 Jun 2016 09:50:39 +0200 |
| Lines | 25 |
| Message-ID | <mailman.110.1466841055.11516.python-list@python.org> (permalink) |
| References | <8c9b5b13-c6cc-458d-9d31-56f7e5db10c4@googlegroups.com> <871t3llnao.fsf@handshake.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Trace | news.uni-berlin.de BiCYG1byUMRO4M5QK1+r0QhetkHtLXZMxRPVzmqeNBtg== |
| Cancel-Lock | sha1:zIO5FF845AWZyvdo6DlBJgSC7HY= |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'exception.': 0.07; 'inserted': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:keys': 0.09; 'wrong,': 0.09; 'output': 0.13; 'def': 0.13; 'commented': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'result:': 0.16; 'subject:access': 0.16; 'surprising': 0.16; 'obviously': 0.16; 'string': 0.17; 'attribute': 0.18; 'versions': 0.20; 'file.': 0.22; 'code.': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:e 30': 0.27; 'str': 0.29; 'subject:that': 0.29; 'print': 0.30; 'comments': 0.30; 'code': 0.30; 'something': 0.35; 'should': 0.36; 'there': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'wrong': 0.38; 'anything': 0.38; 'means': 0.39; 'does': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'your': 0.60; 'sample': 0.63; 'here': 0.66; 'obvious': 0.76; 'composing': 0.84; 'successively': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | p57b39a59.dip0.t-ipconnect.de |
| User-Agent | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <871t3llnao.fsf@handshake.de> |
| X-Mailman-Original-References | <8c9b5b13-c6cc-458d-9d31-56f7e5db10c4@googlegroups.com> |
| Xref | csiph.com comp.lang.python:110494 |
Show key headers only | View raw
Sayth Renshaw <flebber.crue@gmail.com> writes: > ... > Can I ask is there something obvious wrong, i have left the commented other versions in they "work" in that they all produce the same output the print whole file. > The code below is obviously wrong - it is surprising that you get anything other than an exception. See comments below inserted into your code. > def parseXML(): > ... > result = etree.tostring(tree.getroot(), pretty_print=True) "result" here is obviously a string. > for sample in result: This means that "sample" successively hold the characters composing the string "result". > noms = (dict(zip(atts, map(sample.attrib.get, atts)))) You should get "AttributeError: str object does not have attribute `attrib`".
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I seem to be creating a dict that I cannot access the keys of Sayth Renshaw <flebber.crue@gmail.com> - 2016-06-23 20:59 -0700
Re: I seem to be creating a dict that I cannot access the keys of dieter <dieter@handshake.de> - 2016-06-25 09:50 +0200
Re: I seem to be creating a dict that I cannot access the keys of Sayth Renshaw <flebber.crue@gmail.com> - 2016-06-25 01:41 -0700
Re: I seem to be creating a dict that I cannot access the keys of dieter <dieter@handshake.de> - 2016-06-27 09:08 +0200
csiph-web