Learn R Programming

pystr (version 2.0.0)

pystr_maketrans: Create a character map.

Description

Create a list of character mappings usable for pystr_translate.

Usage

pystr_maketrans(x, y)

Arguments

x
A string.
y
A string.

Value

A list of character mappings for use in pystr_translate.

Details

The two arguments must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y.

References

https://docs.python.org/3/library/stdtypes.html#str.maketrans

See Also

pystr_translate

Examples

Run this code
map = pystr_maketrans("abc", "123")
pystr_translate("a blue cat", map)

Run the code above in your browser using DataLab