__author__ = 'mare' d = dict(a=1, b=3, c=5) #{'a': 1, 'c': 5, 'b': 3} type(d) #< type 'dict'> color = {"apple":"red", "banana":"yellow"} #{'apple': 'red', 'banana': 'yellow'} print( color["apple"] ) #red #color[0] is not support, error #color += {"cherry":"red"} -> error color["cherry"] = "red" #{'cherry': 'red', 'apple': 'red', 'banana': 'yellow'} color["apple"] = "green" #{'cherry': 'red', 'apple': 'green', 'banana': 'yellow'} #items(), keys(), values() for c in color.items(): print(c) #('apple', 'green') #('cherry', 'red') #('banana', 'yellow') print('--') for k, v in color.items(): print(k, v) #apple green #cherry red #banana yellow print('--') for k in color.keys(): print(k) #apple #cherry #banana print('--') for v in color.values(): print(v) #green #red #yellow del color['cherry'] print(color) color.clear() #{'apple': 'green', 'banana': 'yellow'} print(color) #{} #more complex s = {'age':40.5, 'job':[1, 2, 3], 'name':{'kim':2, 'Cho':1}} print(s) #{'name': {'Cho': 1, 'kim': 2}, 'age': 40.5, 'job': [1, 2, 3]}
1/22/2014
(python study) about dictionary variable (example source code)
Subscribe to:
Post Comments (Atom)
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
As you can see in the following video, I created a class that stitching n cameras in real time. https://www.youtube.com/user/feelmare/sear...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
My Environment : MS VS 2008 & MFC(Dialog Based) Joy Stick : Logitech Extreme 3D pro (XBox Type) Cteated Date : 2012. 03 [source code]...
-
Created Date : 2011.10 Language : C/C++ Tool : Microsoft Visual C++ 2008 Library & Utilized : OpenCV 2.3 Reference : SIFT referenc...
-
This is GPU version of this page -> http://feelmare.blogspot.kr/2013/12/finding-largest-subset-images-that-is.html Please refer detail ...
-
Created Date : 2007.8 Language : C/C++ Tool : Microsoft Visual C++ 6.0 (MFC) Library & Utilized : - Reference : Simplified approach ...
-
This is example class creation. RotatedRect tRect(Point2f(p2.x, p2.y), Size2f(W,H), atan(mn.first)*180/3.1415); In Here, p2.x, p2.y is ...
-
Video stabilization example source code. The principle is like that... Firstly, to obtain 2 adjacent images extract good feature to t...
-
numberList = [ 1 , 2 , 3 , 4 , 5 ] strList = [ 'one' , 'two' , 'three' , 'five' ] # No iterables are passe...
No comments:
Post a Comment