3 ms·
You may find that actually making this code to use data from user-provided data will make the code look quite unnatural and I doubt it would be accidentally wri
by _flux 5y ago
You may find that actually making this code to use data from user-provided data will make the code look quite unnatural and I doubt it would be accidentally written.
For example:
>>> user_data='{print("helo"}}'
>>> print(user_data)
{print("helo"}}
>>> print(f"{user_data}")
{print("helo"}}
>>> print(f"user_data")
user_data
>>> print(user_data.format())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'print("helo"'
Maybe there's some other way to express this bug?
- Quekid5 5y agoYeah, that's why I was quite skeptical about the exact scenario... it would probably look very out of place, but I don't have enough RW experience in Python to say for sure.