Skip to content Skip to sidebar Skip to footer

Pycharm: Read From Standard Input In "debug" Mode

I'm debugging this script in PyCharm: import sys def read_in(): lines = sys.stdin.readlines() for i in range(len(lines)): lines[i] = lines[i].replace('\n','')

Solution 1:

Personally, I'd just use patch to replace sys.stdin.readlines() with a Mock, with the return value you desire. Place that into a unit test, and run the unit test.

Also, see Reading from a file with sys.stdin in Pycharm


Post a Comment for "Pycharm: Read From Standard Input In "debug" Mode"