str2d.Str2D.join_h

classmethod Str2D.join_h(*args: Str2D, sep: str = '') Str2D[source]

join_h joins any number of Str2D objects horizontally. The sep is the separator that will be added between the joined data.

Parameters:
  • args (Tuple[Str2D]) – The Str2D objects to join horizontally.

  • sep (str, optional) – The separator to insert between the joined data, by default ‘’.

Returns:

A new Str2D object with the joined data.

Return type:

Str2D

See also

join_v

Join the data vertically

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 join the data horizontally by passing the Str2D objects to the join_h method.

Str2D.join_h(a, b, c)
a b c d1 2 3x y z
e f g  4 5 6u v w
h i    7 8 9q r s
j

We can also pass a separator

Str2D.join_h(a, b, c, sep='|')
a b c d|1 2 3|x y z
e f g  |4 5 6|u v w
h i    |7 8 9|q r s
j      |     |