Two values from one input in python?

前端 未结 18 2223
小鲜肉
小鲜肉 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 04:07

    All input will be through a string. It's up to you to process that string after you've received it. Unless that is, you use the eval(input()) method, but that isn't recommended for most situations anyway.

    input_string = raw_input("Enter 2 numbers here: ")
    a, b = split_string_into_numbers(input_string)
    do_stuff(a, b)
    

提交回复
热议问题