Posts

Showing posts with the label Diectionary element delete

Dictionary Accessing

Image
Dictionary Accessing  Jython provides many sequqnces and datastructures. Here is a map type where it is a combination of key and value pair or elements in a list. Diectonary in Jython script Lets do the experiment with Dictonary objects in Jython. Example of Dicttionary objects in Jython #This script is for adding, deleting, modifying,itrating. D={'dmgr':'10.12.13.14:80','app1':'10.0.0.12:90','app2':'10.0.0.15:100'} #Adding a element to dictionary D. D['app3']='10.1.1.12:85' #Update with New dictionary D2={'app4':'10.0.0.0:95'} D.update(D2) for k,v in D.items(): print k,'->',v #modifying dictionary element print 'modifying the dictionary app2' D['app2']='10.0.0.15:98' for k,v in D.items(): print k,'->',v keylist=D.keys() k=keylist.sort() print keylist for k in keylist: print k,'->',D[k] O/P wsadmin>exec...