1. The priority queue in Python, priorityqueue usage: the smaller the number, the higher the priority, the sooner it is taken out
fromQueueImportQueue fromQueueImportPriorityqueueprioqueue=priorityqueue () prioqueue.put (1,'hahaha')) Prioqueue.put (5,'USTC')) Prioqueue.put (2,'NWSUAF')) Prioqueue.put (3,'Tsinghua')) Prioqueue.put (6,'Peking')) Prioqueue.put (4,'Zhejiang')) whilePrioqueue:Print(Prioqueue.get_nowait ())
2. Matplotlib drawing, displaying various colors, drawing function values in corresponding positions, controlling the range of axes, writing on diagrams
ImportPylab as PLImportMatplotlibx=[10,20,11,12,15,25]y=[3,6,9,8,7,4]co=[1,2,3,4,5,6]FIG1=pl.figure () cm=pl.get_cmap ("RDYLGN") forIinchRange (0,len (x)): Pl.plot (X[i],y[i],'o', COLOR=CM (CO[I]*1.0/6) ) Pl.text (X[i],y[i],str (y[i])+'*', color='Red') Pl.xlim (0,45) Pl.title ('Cluster Graph') pl.show ()
Python used a little knowledge memo