I am using python 3.9.5
, and PyYaml 5.4.1
.
I have a file t.yml
with the following content.
- ⬆️
I have written a simple python code, to read the yaml file and dump it back.
import yaml
with open("t.yml") as file:
con = yaml.safe_load(file)
print(con)
with open("t.yml","w") as file:
yaml.dump(con,file)
The output of the code is:
['⬆️']
After dumping the yaml, the t.yml
file becomes like this:
- "\u2B06\uFE0F\U0001F622"
How can I dump the emojis in the exact same format, I loaded them ?