#NEWLINE# def strings( filename , minimum = 4 ) : #NEWLINE# #INDENT# '\n    A strings generator, similar to the Unix strings utility.\n\n    @filename - The file to search for strings in.\n    @minimum  - The minimum string length to search for.\n\n    Yeilds printable ASCII strings from filename.\n    ' #NEWLINE# result = '' #NEWLINE# with BlockFile ( filename ) as f : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# ( data , dlen ) = f . read_block ( ) #NEWLINE# if ( not data ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# for c in data : #NEWLINE# #INDENT# if ( c in string . printable ) : #NEWLINE# #INDENT# result += c #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( result ) >= dlen ) : #NEWLINE# #INDENT# ( yield result ) #NEWLINE# result = '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = ''