約195件1ページ目

日本語のみで絞り込む

2011/4/13 -If d is your deque, use. if d: # not empty else: # empty. This will implicitly convert d to a bool , which yields True if the deque contains ...

2025/7/23 -The bool() method converts the deque into a Boolean and if the value is False it indicates the deque is empty.

2025/10/30 -The .clear() method in Python's collections.deque class removes all elements from the deque, leaving it empty. It's useful when the contents ...

2008/9/17 -Unless I'm missing something, the only way to tell if a deque is empty is to try and pop() something and catch the resulting IndexError. This is ...

Returns a new deque object initialized left-to-right (using append() ) with data from iterable. If iterable is not specified, the new deque is empty. Deques are ...

isEmpty() tests to see whether the deque is empty. It needs no parameters and returns a boolean value. size() returns the number of items in the deque. It needs ...

2026/10/25 -A deque is a sequence container from the collections module that is optimized for adding and removing items at both ends. According to the ...

2004 • collections.deque Added (Python 2.4) ... First, import deque from the collections module, then create an empty deque to serve as our print queue.

2023/4/23 -So to check if a deque is empty, we'll have to check its length. If the length of the deque is 0, it's an empty deque. Let's see how we can do ...

The easiest way is to use the `is_empty()` method if you're using Python's `queue.Queue` or a custom class, or just check `if not queue:` if you're using a ...