Get the App
SLTechnology News&Howtos  ›  Development  › 

How python implements queues that are operable at both ends

Shulou Source: shulou.com Published: 2022-06-01 05:43:02 10月03日 Update

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!

Tags: Both ends queue content article value interest guy partner more knowledge industry information channel channel reference help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Apple NVidia vpn Huawei