Trouble with map()

0 votes
I want to convert the values of a list using the map function but i am getting a strange result.

s = input("input some numbers: ")
i = map(int, s.split())

input some numbers: 4 58 6
<map object at 0x00000000031AE7B8>

why does it not return ['4','58','6']? How do I fix this?
May 2 in Python by ana1504.k
• 6,110 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
You are using python 3 which returns generators instead of lists.

Call list(x) on the variable after you assign it the map generator.
answered May 2 by SDeb
• 9,660 points

Related Questions In Python

0 votes
1 answer

How is lambda() used with map() in python?

The map() function in Python takes in ...READ MORE

answered 6 days ago in Python by Takeshi
0 votes
1 answer

Map function with example in python

The map function executes the function_object for each ...READ MORE

answered 2 days ago in Python by Imran
+2 votes
2 answers

How can I replace values with 'none' in a dataframe using pandas

Actually in later versions of pandas this ...READ MORE

answered Aug 13, 2018 in Python by bug_seeker
• 14,970 points
0 votes
1 answer

Need help writing a dataframe into a csv with the help of a loop

Using the following logic you can arrive ...READ MORE

answered Apr 17, 2018 in Python by anonymous
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
0 votes
10 answers
0 votes
1 answer

Increment with ++ in Python

Python doesn't support ++, so we use: number ...READ MORE

answered Nov 8, 2018 in Python by SDeb
• 9,660 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.