#!/usr/bin/env python3
"""
For the last column, print only the first character.
Usage:

    $ printf "100,200\n0,\n" | python3 first_char_last_column.py

Should print "100,2\n0,"
"""

import csv
from sys import stdin, stdout


def main():
    reader = csv.reader(stdin)
    writer = csv.writer(stdout)

    for row in reader:
        try:
            row[-1] = row[-1][0]
        except IndexError:
            # Python: Better to ask forgiveness than permission
            # Alternative: Look before you leap
            pass
        writer.writerow(row)


if __name__ == "__main__":
    main()

[((16, 13, 16, 30), 'csv.reader', 'csv.reader', ({(16, 24, 16, 29): 'stdin'}, {}), '(stdin)', False, 'import csv\n'), ((17, 13, 17, 31), 'csv.writer', 'csv.writer', ({(17, 24, 17, 30): 'stdout'}, {}), '(stdout)', False, 'import csv\n')]