python - backslash in Yaml string -
this question has reply here:
why backslashes appear twice? 1 replyso i'm using yaml configuration files , py yaml parse it. 1 field have like:
host: hostname\server,5858
but when gets parsed here get:
{ "host": "hostname\\server,5858" }
with 2 backslashes. tried every combination of single quotes, double quotes, etc. what's best way parse correctly ? thanks
len("\\") == 1
. see representation of string python string literal. backslash has special meaning in python literal e.g., "\n"
single character (a newline). literal backslash in string, should escaped "\\"
.
python yaml
No comments:
Post a Comment