Python iter() FunctionThe python iter() function is used to return an iterator object. It creates an object which can be iterated one element at a time. SignatureParametersobject: An iterable object. sentinel (optional)- It is a special value that represents the end of a sequence. ReturnIt returns an iterator object. Python iter() Function Example 1The below example shows the working of iter(). Output: 1 2 3 4 5 Explanation: In the above example, iter() function converts an list iterable to an iterator.
Next TopicPython Functions
|