Python Forum
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using map function
#2
The first argument of map is the function which is called repeatedly with the elements of the iterable. Don't call the function when you pass it to a map function.

def name_split(name):
    return name.split()

people = ['Dr. Christopher Brooks', 'Dr. Kevyn Collins-Thompson', 'Dr. VG Vinod Vydiswaran', 'Dr. Daniel Romero']
splitted_names = list(map(name_split, people))
print(splitted_names)
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
using map function - by uttamsaha2 - Aug-05-2017, 10:28 AM
RE: using map function - by DeaD_EyE - Aug-05-2017, 02:10 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020