def main():
    inwas = []
for line in sys.stdin:
    inwas.append(line)
print('%d lines' % len(inwas), end=' ')
print('initials:', ''.join(x[0] for x in inwas))
if __name__ == '__main__':
    main()
How to send EOF to Python sys.stdin from commandline? CTRL-D doesn't work