How to prevent YAML to dump long line without new line

前端 未结 1 1598
名媛妹妹
名媛妹妹 2021-02-12 13:29

Whenever my option goes beyond certain limit, pyyaml converts it into two lines.

How to avoid this ?

e.g.

In [1]: x = \"-c /home/user/test/test2/test23/t

1条回答
  •  孤城傲影
    2021-02-12 13:42

    Thanks @MathieuMarques for suggesting to look @ dump options and link provided, YAML documentation was not good enough to find it out.

    Anyways solution is to specify width parameter for dump function.

    i.e. yaml.dump(data, width=1000)

    0 讨论(0)
提交回复
热议问题