# print-ascii-art.py by Jadrian Miles. import sys def printAsciiArt(data, width): """Prints ASCII art, stored as a single string (data), on lines with the given column width.""" for i in range(0, len(data), width): print data[i:(i+width)] def main(): if len(sys.argv) < 3: print "Usage: python print_ascii_art.py " print " where is a plain text file" print " and is an integer (# columns in the image)." return image_file = open(sys.argv[1]) image_data = image_file.read() image_file.close() printAsciiArt(image_data, int(sys.argv[2])) if __name__ == "__main__": main()