If you don't want to touch stdin and simulate as if you had passed "python cmdfile.py", you can do the following from a bash shell:
$ python <(printf "word=raw_input('Enter word: ')\nimport sys\nfor i in range(5):\n print(word)")
As you can see, it allows you to use stdin for reading input data. Internally the shell creates the temporary file for the input command contents.