How do I read a text file in python via PowerShell? Windows 10

Viewed 2603

I'm having problems reading text files into my python programs.

import sys

words = sys.stdin.readlines()

I'm reading the file in through stdin but when I try to execute the program I'm getting this error.

PS> python evil_61.py < evilwords.txt

At line:1 char:19
+ python evil_61.py < evilwords.txt
+                   ~

The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

Could someone tell me how to run these kinds of programs as it is essential for my course and I'd rather use Windows than Linux.

2 Answers
Related