ascii.py

#! /usr/bin/python3
# ===================================================================
#
# ===================================================================

i   = 0 
max = 128

def print_last_char(c):
    if c.isprintable():
        print(f"'{c}']")
    else:
        print("'']")



print('ascii[',end='')

while i < max:

    c = chr(i)

    if i == max-1:
        print_last_char(c)
        break

    if c.isprintable():
        print(f"'{c}',",end='')
    else:
        print("'',",end='')

    i += 1

    if i % 16 == 0:
        print('\n      ',end='')