-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
create a file with following contents and name it target.py:
phys_vol_name = "test123"
raise RuntimeError(f'Can\'t find the volume group "{phys_vol_name}"')then use this script to parse & unparse to create new file result.py
import ast
import astunparse
with open("target.py", "r") as f:
res = astunparse.unparse(ast.parse(f.read()))
with open("result.py", "w") as ff:
ff.write(res)when you run result.py you get syntaxt error:
File "result.py", line 3
raise RuntimeError(f"""Can't find the volume group "{phys_vol_name}"""")
^
SyntaxError: EOL while scanning string literalPietroPasotti
Metadata
Metadata
Assignees
Labels
No labels