How python implements queues that are operable at both ends
This article mainly introduces how to realize the queue that can be operated at both ends by python. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
A queue that is operable at both ends
> > Q = collections.deque () > > Q.append (1) > > Q.appendleft (2) > Q.extend ([3,4]) > Q.extendleft ([5,6]) > > Qdeque ([6,5,2,1,3,4]) > > Q.pop () 4 > > Q.popleft () 6 > Qdeque ([5,2,1,3]) > > Q.rotate (3) > > Qdeque ([2,1,3,5]) > > Q.rotate (- 3) > Qdeque ([5,2,1,3]) 3]) these are all the contents of the article "how python implements queues that can be operated at both ends" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!