Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71210
| X-Received | by 10.236.231.52 with SMTP id k50mr6316194yhq.52.1399684964279; Fri, 09 May 2014 18:22:44 -0700 (PDT) |
|---|---|
| X-Received | by 10.50.143.1 with SMTP id sa1mr181793igb.12.1399684964183; Fri, 09 May 2014 18:22:44 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!ih12no2058439qab.1!news-out.google.com!gi6ni804igc.0!nntp.google.com!c1no3915106igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Fri, 9 May 2014 18:22:43 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=137.189.150.195; posting-account=pmbo9woAAAB1Q_wtWh-peHRAtPfBEWkK |
| NNTP-Posting-Host | 137.189.150.195 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <1ba8744e-943b-4c71-abd7-9dea12db8780@googlegroups.com> (permalink) |
| Subject | How to implement key of key in python? |
| From | eckhleung@gmail.com |
| Injection-Date | Sat, 10 May 2014 01:22:44 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Received-Bytes | 2004 |
| X-Received-Body-CRC | 187957806 |
| Xref | csiph.com comp.lang.python:71210 |
Show key headers only | View raw
I'm migrating from Perl to Python and unable to identify the equivalent of key of key concept. The following codes run well,
import csv
attr = {}
with open('test.txt','rb') as tsvin:
tsvin = csv.reader(tsvin, delimiter='\t')
for row in tsvin:
ID = row[1]
until:
attr[ID]['adm3'] = row[2]
I then try:
attr[ID].adm3 = row[2]
still doesn't work. Some posts suggest using module dict but some do not. I'm a bit confused now. Any suggestions?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
How to implement key of key in python? eckhleung@gmail.com - 2014-05-09 18:22 -0700
Re: How to implement key of key in python? CHIN Dihedral <dihedral88888@gmail.com> - 2014-05-09 19:21 -0700
Re: How to implement key of key in python? MRAB <python@mrabarnett.plus.com> - 2014-05-10 03:30 +0100
Re: How to implement key of key in python? eckhleung@gmail.com - 2014-05-09 20:28 -0700
Re: How to implement key of key in python? Andrea D'Amore <anddamNOALPASTICCIODICARNE+gruppi@brapi.net> - 2014-05-10 09:07 +0200
Re: How to implement key of key in python? Peter Otten <__peter__@web.de> - 2014-05-10 10:21 +0200
csiph-web