pythonizer icon indicating copy to clipboard operation
pythonizer copied to clipboard

Escaped interpolation symbols in "..." generate incorrect python code

Open snoopyjc opened this issue 3 years ago • 1 comments

Escaped interpolation symbols in "..." generate incorrect python code. Also, symbols { and } need to be escaped (by doubling them) in python f"..." strings. For example:

print "three=i\@{3}\$\n";
print "three=i{3}$i\n";

Generates:

print(f"three=i\@{3}\$")
print(f"three=i{3}{i}")

Instead of:

print("three=i@{3}$")
print(f"three=i{{3}}{i}")

snoopyjc avatar Nov 19 '21 05:11 snoopyjc

Fixed in https://github.com/snoopyjc/pythonizer

snoopyjc avatar Feb 07 '22 16:02 snoopyjc