Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using map(int, raw_input().split())

Though I like python very much, When I need to get multiple integer inputs in the same line, I prefer C/C++. If I use python, I use:

a = map(int, raw_input().split())

Is this the only way or is there any pythonic way to do it? And does this cost much as far as time is considered?

like image 295
Aswin Murugesh Avatar asked Jun 15 '13 08:06

Aswin Murugesh


1 Answers

You can use this:

s = raw_input().split()
s = [int(i) for i in s]
like image 101
Tanay Agrawal Avatar answered Sep 21 '22 04:09

Tanay Agrawal