Two values from one input in python?

前端 未结 18 2199
小鲜肉
小鲜肉 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条回答
  •  孤城傲影
    2020-11-28 03:54

    The easiest way that I found for myself was using split function with input Like you have two variable a,b

    a,b=input("Enter two numbers").split()
    

    That's it. there is one more method(explicit method) Eg- you want to take input in three values

    value=input("Enter the line")
    a,b,c=value.split()
    

    EASY..

提交回复
热议问题