berry icon indicating copy to clipboard operation
berry copied to clipboard

%q format specifier is invalid

Open Alex-x90 opened this issue 2 years ago • 2 comments

According to Chapter-7.rst, there should be a format specifier %q which results in the string being between quotes with special characters escaped (equivalent to string.escape as I understand). When I run the following code it says invalid option '%q' to 'format'.

import string
print(string.format("%q","test"))

Alex-x90 avatar Oct 14 '23 12:10 Alex-x90

This is a documentation bug. It was never implemented. You should use %q with json.dump() as a replacement.

I will check however if it's easy to add

s-hadinger avatar Oct 14 '23 17:10 s-hadinger

On 2023-07-09 I removed the unimplemented %q from the wiki markdown page Chapter 7, which seems to be where the most recent docs are, instead of the .rst files in docs/source/en.

sfromis avatar Nov 11 '23 16:11 sfromis

%q is now supported, short manual and documentation have been updated

s-hadinger avatar Apr 17 '24 20:04 s-hadinger