Как считать 2 числа из одной строки в python
Перейти к содержимому

Как считать 2 числа из одной строки в python

  • автор:

Two values from one input in python? [duplicate]

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 one line of Python?

For instance, in C I can do something like this: scanf(«%d %d», &var1, &var2) . However, I can’t figure out what the Python equivalent of that is. I figured it would just be something like var1, var2 = input(«Enter two numbers here: «) , but that doesn’t work and I’m not complaining because it wouldn’t make a whole lot of sense if it did.

Does anyone out there know a good way to do this elegantly and concisely?

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *