sys.stdin.readline() reads without prompt, returning 'nothing in between'

前端 未结 6 2279
被撕碎了的回忆
被撕碎了的回忆 2021-02-12 15:49

I have a function that executes the following (among other things):

userinput = stdin.readline()
betAmount = int(userinput)

Is supposed to tak

6条回答
  •  后悔当初
    2021-02-12 16:16

    import sys
    userinput = sys.stdin.readline()
    betAmount = int(userinput)
    
    print betAmount
    

    This works on my system. I checked int('23\n') would result in 23.

提交回复
热议问题