ToString

Pydoc 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).

Pydoc Pydoc