Using list/generator comprehensions is preferable (more Pythonic) to map():

def rot_13(string):
    alph = 'abcdefghijklmnopqrstuwxyz'
    return ''.join(alph[(alph.find(i)+13) % len(alph)] for i in string)
Answer from AKX on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-map-function
Python map() function - GeeksforGeeks
Explanation: lambda s: s[0] extracts first character from each string in the list words. map() applies this lambda function to every element, resulting map object is converted to a list of the first characters using list().
Published: June 26, 2026
๐ŸŒ
TechBeamers
techbeamers.com โ€บ python-map-function
Python Map Function - TechBeamers
November 30, 2025 - The input iterable, 'Python' is a String. Its length is 6. Type of map_result is <class 'map'> Lengths are: 1 1 1 1 1 1
๐ŸŒ
Prospero Coder
prosperocoder.com โ€บ home โ€บ string mapping in python
String Mapping in Python - Prospero Coder
May 2, 2022 - Before the translate method translates the characters, we want to delete all aโ€™s and lโ€™s from the string: >>> deltab = "al" >>> translation_tab = text.maketrans(intab, outtab, deltab) In the output we can see that there are fewer characters than before due to the fact that some were deleted: >>> print(text.translate(translation_tab)) S., ftmr thm chngms rm ppxmd, y.$ w.n't rmc.gnxzm thxs tmxt. ... Learn the basics of Python, including OOP.
๐ŸŒ
Guru99
guru99.com โ€บ home โ€บ python โ€บ python map() function with examples
Python map() Function with EXAMPLES
2 weeks ago - Python map() applies a given function to every item of an iterable such as a list, tuple, set, dictionary, or string.
๐ŸŒ
Real Python
realpython.com โ€บ videos โ€บ manipulating-strings-map
Manipulating Strings With map() (Video) โ€“ Real Python
09:03 This is going to be the function that weโ€™re going to use in the map() call. Itโ€™s going to take a word string and itโ€™s going to return the string obtained by removingโ€”or by stripping awayโ€”any of these characters.
Published: April 27, 2021
๐ŸŒ
Real Python
realpython.com โ€บ python-map-function
Python's map(): Processing Iterables Without a Loop โ€“ Real Python
March 18, 2026 - The following sections will walk you through some examples of how to use map() to transform iterables of string objects. A quite common approach to string manipulation is to use some of the methods of the class str to transform a given string into a new string.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ string โ€บ format_map
Python String format_map()
class Coordinate(dict): def __missing__(self, key): return key print('({x}, {y})'.format_map(Coordinate(x='6'))) print('({x}, {y})'.format_map(Coordinate(y='5'))) print('({x}, {y})'.format_map(Coordinate(x='6', y='5')))
Find elsewhere
๐ŸŒ
Python Central
pythoncentral.io โ€บ how-to-use-the-python-map-function-step-by-step
How To Use the Python Map Function (Step by Step) | Python Central
September 27, 2022 - If some of your solutions involve working with iterables holding string objects, you may need to transform the objects using some sort of transformation function. The map() function can come in handy in these situations.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-implement-map-string-int-myMap-in-a-python-like-c++
How to implement 'map<string, int> myMap' in a python like c++ - Quora
Answer (1 of 4): Usually you just [code]myMap = dict() myMap['str'] = 1 [/code]But that is not quite the same as [code ]std::map [/code] for two reasons: 1. std::map is ordered, while dict() is an unordered map. Pythonโ€™s OrderedDict is ordered but not by key order. SortedDict i...
๐ŸŒ
DEV Community
dev.to โ€บ catundanatalia โ€บ map-and-join-and-strings-2p8
Map and Join and Strings() - DEV Community
June 15, 2020 - #python #functional ยท Sometimes you try to find how to loop an Array and transform its all elements.The map() function can do it for you. In this example, we get all numbers in a list and transform them into strings with map and join. example: my_list = ["natalia","have:",1000,"dolars","in",2020] list = map(str,my_list) print(" ".join(list)) Subscribe ยท
๐ŸŒ
Medium
medium.com โ€บ @tanvijain17 โ€บ how-to-use-the-map-function-in-python-d8db02f12653
How to use the map function in Python | by Tanvi Jain | Medium
March 4, 2024 - We then use the map() function to apply the len() function to each element in the list, which calculates the length of each string. The result is a map object containing the lengths of the strings.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ python-map-function
Python map() function | DigitalOcean
August 3, 2022 - Technical tutorials, Q&A, events โ€” This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 72928306 โ€บ how-to-map-each-character-in-a-string-to-a-value
python - How to map each character in a string to a value? - Stack Overflow
but new assignment can be avoided, you can use values directly using eval from the string: Copystring = 'python' for i in string: print(eval(i)) # 15 # 24 # 19 # 7 # 14 # 13
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ built-in โ€บ map
Python map() Function
For example, num1 = [1, 2, 3] num2 ... lambda function is used within map() to add the corresponding elements of the both lists. We can use map() function to modify the string....
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-map-function-how-to-map-a-list-in-python-3-0-with-example-code
Python Map โ€“ How to Map a List in Python 3.0, With Example Function Code
April 12, 2021 - Instead of iterating through each member of the list of strings, the Python Map Function transformed the entire list of strings to a list of numbers.
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ artificial intelligence โ€บ the map function in python
The Map Function in Python | Towards Data Science
April 17, 2021 - The function we pass in to the map function will be a lambda function, which takes each element from the msg string, and if the element is a letter in the alphabet, it replaces it with the shifted letter depending on the n value we pass in. It does so by taking the current index of that letter in the alphabet, or abc.index(x), adds the n value to it, and then takes the modulus of that sum.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_map.asp
Python map() Function
Remove List Duplicates Reverse ... Study Plan Python Interview Q&A Python Training ... The map() function executes a specified function for each item in an iterable....
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ map-function
Python Map Function: Streamline Data Transformation Efforts
def to_uppercase(s): return s.upper() strings = ["hello", "world", "python"] upper_strings = map(to_uppercase, strings) print(list(upper_strings)) # Outputs: ['HELLO', 'WORLD', 'PYTHON']
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-map-function
Python map() Function: A Complete Guide | DataCamp
December 10, 2025 - The map() function is a built-in Python utility that applies a specified function to every item in an iterable (like a list, tuple, or string) and returns an iterator with the transformed results.