Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import collections
- # Add to the right
- d1 = collections.deque()
- d1.extend('abcdefg')
- print 'extend :', d1
- d1.append('h')
- print 'append :', d1
- # Add to the left
- d2 = collections.deque()
- d2.extendleft(xrange(6))
- print 'extendleft:', d2
- d2.appendleft(6)
- print 'appendleft:', d2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement