I am trying to read and dump a list to yaml using the following code
with open(system_bsc_path) as f:
system_bsc_dict = yaml.load(f)
with open(system_bsc_path, "w") as f:
yaml.safe_dump(system_bsc_dict, f)
The input list, as in the file:
chs_per_cath: [[[10, 11, 12, 13], [13000, 13100, 13200, 13300]],
[[16, 17, 18, 19, 20, 21, 22, 23, 24, 25], [13400, 13500, 13600, 13700, 13800, 13900, 14000, 14100, 14200, 14300]],
[[32, 33, 34, 35, 36, 37, 38, 39, 40, 41], [13400, 13500, 13600, 13700, 13800, 13900, 14000, 14100, 14200, 14300]]]
is read properly into python
The output that gets dumped:
chs_per_cath:
- - - 10
- 11
- 12
- 13
- - 13000
- 13100
- 13200
- 13300
- - - 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- - 13400
- 13500
- 13600
- 13700
- 13800
- 13900
- 14000
- 14100
- 14200
- 14300
- - - 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- - 13400
- 13500
- 13600
- 13700
- 13800
- 13900
- 14000
- 14100
- 14200
- 14300
How can I get the same output as the input?