From c82d537b796513ad66ac0261cd55e48b625d7ac5 Mon Sep 17 00:00:00 2001 From: Amandine PERRIN <amandine.perrin@pasteur.fr> Date: Thu, 12 Sep 2019 11:26:36 +0200 Subject: [PATCH] Possibility to change separator in list_to_str --- PanACoTA/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PanACoTA/utils.py b/PanACoTA/utils.py index 13ca5fdc..108df9d1 100755 --- a/PanACoTA/utils.py +++ b/PanACoTA/utils.py @@ -1220,7 +1220,7 @@ def write_list(list_names, fileout): fo.write(genome + "\n") -def list_to_str(list): +def list_to_str(list, sep='\t'): """ Return a string corresponding to the given list, with all elements separated by a space. Used to write a list into a file. Ex:: @@ -1231,6 +1231,8 @@ def list_to_str(list): ---------- list : list list of elements that we would like to write + sep : str + Separator to use between the different elements Returns ------- @@ -1238,7 +1240,7 @@ def list_to_str(list): the string to write """ list_write = [str(l) for l in list] - return " ".join(list_write) + "\n" + return sep.join(list_write) + "\n" def remove(infile): -- GitLab