Commit 1bcb37e33d763edd37ff803686c6524378ebcd22
1 parent
4309b4a340
Exists in
master
Now, we can write files with only one value without including it in a list.
Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff
volia/core/data.py
... | ... | @@ -127,8 +127,11 @@ |
127 | 127 | values (list, optional): list of values to write, features or labels. Defaults to []. |
128 | 128 | out (_io.TextIOWrapper, optional): . Defaults to sys.stdout. |
129 | 129 | """ |
130 | - if len(values) == 0: | |
131 | - out.write(str(id_) + "\n") | |
130 | + if hasattr(values, '__len__'): | |
131 | + if len(values) == 0: | |
132 | + out.write(str(id_) + "\n") | |
133 | + else: | |
134 | + out.write(str(id_) + " " + " ".join(values) + "\n") | |
132 | 135 | else: |
133 | - out.write(str(id_) + " " + " ".join(values) + "\n") | |
136 | + out.write(str(id_) + " " + str(values) + "\n") |