str2d.Str2D.__truediv__

Str2D.__truediv__(other: Str2D | str, right_side=False) Str2D[source]

Division is the vertical analog of the addition operation. We can divide a Str2D object by another Str2D object in order to concatenate them vertically. Both objects will be expanded to have the same width while respecting the alignment parameters. When dividing by str object, the expansion will use the expansion argument ‘mode’ set to ‘edge’. This allows the expansion to repeat the string intuitively to the edge of the Str2D object.

Parameters:
  • other (Union[Str2D, str]) – The Str2D object or string to divide.

  • right_side (bool, optional) – If True, the Str2D object will be below the other Str2D object, by default False.

Returns:

A new Str2D object with the divided data.

Return type:

Str2D

See also

__truediv__

Divide the data.

__rtruediv__

Divide the data.

div

Divide the data.

Examples

Let’s create several instances of Str2D and assign them to the variables a, b, and c.

from str2d import Str2D

a = Str2D('a b c d\ne f g\nh i\nj')
b = Str2D('1 2 3\n4 5 6\n7 8 9')
c = Str2D('x y z\nu v w\nq r s')

We can divide the data vertically by using the Str2D objects with the /

a / b / c
a b c d
e f g
h i
j
1 2 3
4 5 6
7 8 9
x y z
u v w
q r s

We can also divide by a string.

a / '-' / c
a b c d
e f g
h i
j
-------
x y z
u v w
q r s

From the right side.

'-' / a
-------
a b c d
e f g
h i
j