# read standard input into a string, convert to list of words, print the words # usage (using xyz.txt as a sample input; xyz.txt could be readinput.py): # python readinput.py < xyz.txt from sys import stdin words = stdin.read() words = words.split() print("Input as a list of words:\n" + str(words))