input 2 variables separated by a comma in a single line

后端 未结 5 1334
长发绾君心
长发绾君心 2021-01-19 15:11

Is it possible to input 2 numbers int or float separated by a comma in a single line?

Say after the program runs it would ask the user to <

5条回答
  •  清歌不尽
    2021-01-19 15:58

    It's my understanding that ast.literal_eval is safe:

    >>> x, y = ast.literal_eval(raw_input('Enter a range: '))
    Enter a range: 5, 6
    >>> x, y
    (5, 6)
    

提交回复
热议问题