Invalid input when pasting any text with newline in PyCharm console Follow
Consider this simple function:
def test():
x = int(input())
y = int(input())
print(x, y)
test()
Run above with PyCharm's python console, it'll ask for input,
paste below input in pycharm console
1
2
Error:
x = int(input())
ValueError: invalid literal for int() with base 10: '1\n2'
It should print: 1 2
This happens with both "python console" and "IPython console" inside PyCharm
Note that this works perfectly from system terminal/command prompt or IDLE and prints: 1 2
Using PyCharm Community 2020.3.
Please sign in to leave a comment.
Just tried without typecast:
It's not working as desired if I paste
Hi,
You can report bugs in our issue tracker https://youtrack.jetbrains.com/issues/py
Thanks Andrey Resler,
I've created a bug here: https://youtrack.jetbrains.com/issue/PY-46489