pyyaml: dumping without tags

前端 未结 5 2000
囚心锁ツ
囚心锁ツ 2021-01-30 19:45

I have

>>> import yaml
>>> yaml.dump(u\'abc\')
\"!!python/unicode \'abc\'\\n\"

But I want

>>> import         


        
5条回答
  •  面向向阳花
    2021-01-30 20:04

    I've just started with Python and YAML, but probably this may also help. Just compare outputs:

    def test_dump(self):
        print yaml.dump([{'name': 'value'}, {'name2': 1}], explicit_start=True)
        print yaml.dump_all([{'name': 'value'}, {'name2': 1}])
    

提交回复
热议问题