Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71210
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-05-09 18:22 -0700 |
| Message-ID | <1ba8744e-943b-4c71-abd7-9dea12db8780@googlegroups.com> (permalink) |
| Subject | How to implement key of key in python? |
| From | eckhleung@gmail.com |
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