print x[x.keys[3]] works, but there might exist a shorter way of doing this…
-Paul > Le 30-08-2015 à 20:49, Eric Martz <ema...@microbio.umass.edu> a écrit : > > load =1al4 > x = {altloc!=""}.altloc.all.pivot > > Now we have an associative array with key:value pairs: > > $ print x > { > "A" : 238 > "B" : 244 > "C" : 34 > "D" : 12 > } > $ print x.type > hash > > I can retrieve the value for key C: > > $ print x..C > 34 > > How do I retrieve a value for the nth element of the array without knowing > the key? > > $ print x.keys[3] > C > > $ print x..x.keys[3] > (prints blank) > > Thanks, Eric > > ------------------------------------------------------------------------------ > _______________________________________________ > Jmol-users mailing list > Jmol-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
_______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users