vert_join

  • full name: tenpy.tools.string.vert_join

  • parent module: tenpy.tools.string

  • type: function

tenpy.tools.string.vert_join(strlist, valign='t', halign='l', delim=' ')[source]

Join multiline strings vertically such that they appear next to each other.

Parameters:
  • strlist (list of str) – the strings to be joined vertically

  • valign ('t', 'c', 'b') – vertical alignment of the strings: top, center, or bottom

  • halign ('l', 'c', 'r') – horizontal alignment of the strings: left, center, or right

  • delim (str) – field separator between the strings

Returns:

joined – a string where the strings of strlist are aligned vertically

Return type:

str

Examples

>>> from tenpy.tools.string import vert_join
>>> print(vert_join(['a\nsample\nmultiline\nstring', str(np.arange(9).reshape(3, 3))],
...                 delim=' | '))  
a         | [[0 1 2]
sample    |  [3 4 5]
multiline |  [6 7 8]]
string    |