ToString
Pydoc |
Transforms every element in an input collection to a string.
Examples
Any non-string element can be converted to a string using standard Python functions and methods.
Many I/O transforms, such as
textio.WriteToText
,
expect their input elements to be strings.
Example 1: Key-value pairs to string
The following example converts a (key, value)
pair into a string delimited by ','
.
You can specify a different delimiter using the delimiter
argument.
Example 2: Elements to string
The following example converts a dictionary into a string.
The string output will be equivalent to str(element)
.
Example 3: Iterables to string
The following example converts an iterable, in this case a list of strings,
into a string delimited by ','
.
You can specify a different delimiter using the delimiter
argument.
The string output will be equivalent to iterable.join(delimiter)
.
Related transforms
- Map applies a simple 1-to-1 mapping function over each element in the collection
Pydoc |
Last updated on 2024/12/20
Have you found everything you were looking for?
Was it all useful and clear? Is there anything that you would like to change? Let us know!