I am trying to convert a list having elements in "key=value" format into a table to display to user. For this I am replacing = sign with tab and adding | at the start and at the end. This is close to what I need, but when it comes to variable length of elements, my solution breaks the formatting. something similar to column -t -s= bash comamnd is required.
import re
my_list_1=["abc=123","def=456","ghi=789","jkl=012"]
my_list_2=["abcalpha=123","def=456","ghicharlie=789","jkl=012"]
#close desired printed
for item in my_list_1:
    item_seprated=re.sub("=","\t",item)
    item_boundary=re.sub("^|$","|",item_seprated)
    print(item_boundary)
print("\n")
#undesired printed
for item in my_list_2:
    item_seprated=re.sub("=","\t",item)
    item_boundary=re.sub("^|$","|",item_seprated)
    print(item_boundary)
desired output for my_list_2:
--------------------
|key       |value  |
--------------------
|abcalpha  |    123|
|def       |    469|
|ghicharlie|    789|
|jkl       |    012|
--------------------  
 
     
     
    