I wonder whether this can be done or not:
So I have a .yaml file with the following pattern
- xxx: xxxxxxx
xxxxxxxxx:
- xxxxxxxxx: xxxx
http_config: %httpProxy%
I want to replace %httpProxy%
with some string displayed in a well-indented new line:
- xxx: xxxxxxx
xxxxxxxxx:
- xxxxxxxxx: xxxx
http_config:
proxy_url: http://proxy:8080
I can use .replace("%httpProxy%", "\n\r proxy_url: http://proxy:8080")
, but I don't want to hard-code the number of spaces (6 in this case) before proxy_url
, as the number of space before http_config
may not necessarily be 4.
Are there any better ideas?