print(keyd[key] we can' delve into their details herebut other python object types also support the iteration protocol and thus may be used in for loops too for instanceshelves (an access-by-key filesystem for python objectsand the results from os popen ( tool for reading the output of shell commandswhich we met in the preceding are iterable as wellimport os os popen('dir' __next__(volume in drive has no label \np __next__(volume serial number is - \nnext(ptypeerror_wrap_close object is not an iterator notice that popen objects themselves support next(method in python in xthey support the __next__(methodbut not the next(pbuilt-in since the latter is defined to call the formerthis may seem unusualthough both calls work correctly if we use the full iteration protocol employed automatically by for loops and other iteration contextswith its top-level iter call (this performs internal steps required to also support next calls for this object) os popen('dir' iter(pnext(ivolume in drive has no label \ni __next__(volume serial number is - \nalso in the systems domainthe standard directory walker in pythonos walkis similarly iterablebut we'll save an example until ' coverage of this tool' basis --generators and yield the iteration protocol also is the reason that we've had to wrap some results in list call to see their values all at once objects that are iterable return results one at timenot in physical listr range( range( iter(rnext( next( list(range( )[ ranges are iterables in use iteration protocol to produce results or use list to collect all results at once iterationsa first look