having a " character before a new line results in restored string having \" in it. Example:
import ast
import astor
length, quotes = 15, 20
text = """
# This is an example configuration
# Hash lines are comments
[flake8]
inline-quotes="Hello"
"""
with open(__file__) as f:
txt = f.read()
tree = ast.parse(txt)
restored = astor.to_source(tree)
print(restored)
Output:
/Users/username/.pyenv/versions/3.7.3/bin/python /Users/username/Library/Preferences/PyCharm2019.2/scratches/bridges.py
import ast
import astor
length, quotes = 15, 20
text = """
# This is an example configuration
# Hash lines are comments"
[flake8]
inline-quotes="Hello\"
"""
with open(__file__) as f:
txt = f.read()
tree = ast.parse(txt)
restored = astor.to_source(tree)
print(restored)
having a
"
character before a new line results in restored string having\"
in it. Example:Output: