だから私はたくさんのトリビアの質問と答えのリストを持つyamlファイルを持っています。しかし、私はこのファイルを読み込み、pyyamlでpythonで内容をダンプしようとすると、それらを逆方向にダンプします。私はそれが私のyamlファイルかどうか、私はライブラリに何か間違っているかどうかはわかりません。PyYamlのものを後ろにダンプする
のは私の質問/回答のペアの一つが、YAMLファイルに次のようになりますことを言ってみましょう -
{"question": "What is the name of this sequence of numbers: 1, 1, 2, 3, 5, 8, 13, ...",
"answer": ["The Fibonacci Sequence", "The Padovan Sequence", "The Morris Sequence"]}
私はPythonの辞書にyaml.dump()を使用すると、それはこのダンプ -
answer: [fibonacci, padovan, morris]\nquestion: 'what sequence is this: 1, 1, 2, 3, 5, 8, 13, ...'\n"
私はこれを期待していた -
- question: "What is the name of this sequence of numbers: 1, 1, 2, 3, 5, 8, 13, ..."
answer: ["The Fibonacci Sequence", "The Padovan Sequence", "The Morris Sequence"]
私はここで何か間違ったことをやっていますか?
ありがとう、私は何か間違っていると私はちょうどそれが何だったのか分からなかった。 –