Public feed #727541

Stuff

public text v1 · immutable
Raw Edit
·published 2007-10-06 03:18 UTC
rendered paste body
def verify_isbn_file(isbn_file):
    '''verify_isbn_file(file) -> boolean
    
    Will print out all the invalid ISBNs in the given text file. If the 
    parameter given is not a file, will return False.'''

    if ( type(isbn_file) != file ):
        return False
    
    print "Invalid ISBN's in file:" 
    for isbn_line in isbn_file:
        isbn_line = isbn_line.replace('\n', '')
        if ( verify_isbn(isbn_line) == False ):
            print isbn_line
    
af = open('isbn_file.txt')
verify_isbn_file(af)