outfile = "out.ws" with open(outfile, "w+") as f: def write(line): print(line, file=f) # Init write(" ") write(" ") def write_char(char): write(" ") write(" " * ord(char)) write(" ") write(" ") write("") flag = "IGCTF{Ha!-I-ain't-seeing-nothing-matter-of-fact-Im-blind-in-my-left-eye-and-43%-blind-in-my-right-eye.}" for c in flag: write_char(c)