[Solved] print key and only one value from dictionary
in python 3.x you can use: for k,v in std.items(): print(k,v[‘Uid’]) in python 2.x: for k,v in std.iteritems(): print(k,v[‘Uid’]) python 3.x code: std={} n=int(input(“How many Entries you have to fill:”)) for i in range (n): name=input(“Enter name:”) uid=input(“ID:”) age=input(“Age:”) print(“—-Marks—-“) math=input(“Maths:”) phy=input(“Physics:”) chem=input(“Chemistry:”) std[name]={‘Uid’:uid,’Age’:age,’subject’:{‘math’:math,’phy’:phy,’chem’:chem}} print(‘\n’) for k,v in std.items(): print(k,v[‘Uid’]) input and results for 2 … Read more