['albert' ['steven'see table - for list of few other itertools functions 've frequently found useful table - some useful itertools functions function description imap(func*iterablesgenerator version of the built-in mapapplies func to each zipped tuple of the passed sequences generator version of the built-in filteryields elements for which ifilter(funciterablefunc(xis true combinations(iterablekgenerates sequence of all possible -tuples of elements in the iterableignoring order permutations(iterablekgenerates sequence of all possible -tuples of elements in the iterablerespecting order groupby(iterable[keyfunc]generates (keysub-iteratorfor each unique key in python several built-in functions (zipmapfilterproducing lists have been replaced by their generator versions found in itertools in python files and the operating system most of this book uses high-level tools like pandas read_csv to read data files from disk into python data structures howeverit' important to understand the basics of how to work with files in python fortunatelyit' very simplewhich is part of why python is so popular for text and file munging to open file for reading or writinguse the built-in open function with either relative or absolute file pathin [ ]path 'ch /segismundo txtin [ ] open(pathby defaultthe file is opened in read-only mode 'rwe can then treat the file handle like list and iterate over the lines like so for line in fpass the lines come out of the file with the end-of-line (eolmarkers intactso you'll often see code to get an eol-free list of lines in file like in [ ]lines [ rstrip(for in open(path)in [ ]lines appendixpython language essentials www it-ebooks info