import sys, string import numpy as np # Example input: "Hello World!!" characters = np.array([' ']+list(open(sys.argv[1]).read())+[' ']) # Result: array([' ', 'H', 'e', 'l', 'l', 'o', ' ', ' ', # 'W', 'o', 'r', 'l', 'd', '!', '!', ' '], dtype=' 1] # Result: [array([' ', 'h', 'e', 'l', 'l', 'o'], dtype='