473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to access second and another value of a key?

Expand|Select|Wrap|Line Numbers
  1. dicc ={ "key" : ["value1", "value2"], ...}
  2.  
How can I access the second value?

I can do :
Expand|Select|Wrap|Line Numbers
  1. for i in dicc:
  2.     print(dicc[i])
  3.  
  4. or
  5.  
  6. for i in dicc:
  7.     print(dicc.get(i))
  8.  
but it will print me both values and i need to access only first one or second one,third etc...cant use slices cooz of the error.
Aug 14 '15 #1

✓ answered by Dietrich41

Expand|Select|Wrap|Line Numbers
  1. dicc = { "key" : ["value1", "value2"]}
  2.  
  3. for k, v in dicc.items():
  4.     print(v[1])
  5.  

1 1313
Expand|Select|Wrap|Line Numbers
  1. dicc = { "key" : ["value1", "value2"]}
  2.  
  3. for k, v in dicc.items():
  4.     print(v[1])
  5.  
Aug 14 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nir | last post by:
Hello All , I need to get access to another session object . It is possible ??? Thanks Nir
2
by: Stoic | last post by:
I'm offering a selection of three items. One is $25, the second is $50, the third is $100. Along with selection one of the items I need to pass the quantity of the selection. Here is the code now....
0
by: B. Massey | last post by:
I'm sure this is a simple problem, but my Access is very rusty. I have inherited a somewhat non-normailized database with some existing jumbled forms. I have two tables without a defined...
2
by: Gopal Prabhakaran | last post by:
Dear All, In one solution , I have 2 webapplication, Now i want to access session value form webapplication 1 to webapplication 2. Pls help ASAP Millions of Thanx in advance.
4
by: jenn | last post by:
Hi Anyone knows how to access to a value of a row in a datalist. Something like this in datagrid Dim str = MyDataGrid.Cell(0).tex I would like something like this Dim str =...
5
by: Peter Olcott | last post by:
I created an object that requires access to another objects data, yet have found no good way to pass this data as a parameter because the member function that requires this data must be a binary...
6
by: Michael | last post by:
How can I get X (or another value) from this string "asdfsadfX", basically i want to get what ever is in between the tags and place them in a variable called $www , can anyone help?
1
by: TeknoShock | last post by:
I am trying to use an if then in javascript to change one value based on what a user inputs for another value. It is not working correctly. Here is the relevant code: ---------------------------...
5
by: konaravikumar | last post by:
writing a query to get the second highest value in atable by using select statement
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.