Two values from one input in python?

前端 未结 18 2256
小鲜肉
小鲜肉 2020-11-28 03:46

This is somewhat of a simple question and I hate to ask it here, but I can\'t seem the find the answer anywhere else: is it possible to get multiple values from the user in

18条回答
  •  旧时难觅i
    2020-11-28 04:16

    You can do this way

    a, b = map(int, input().split())
    

    OR

    a, b = input().split()
    print(int(a))
    

    OR

    MyList = list(map(int, input().split()))
    a = MyList[0]
    b = MyList[1]
    

提交回复
热议问题