both
x = 1
f"{x}"
and
x = '1'
f"{x}"
give
'1'
as output. How do I get "1" and "'1'" as output?
both
x = 1
f"{x}"
and
x = '1'
f"{x}"
give
'1'
as output. How do I get "1" and "'1'" as output?
if you want to get the specific output to read:
"'1'" (text with quotes) and
"1" (text without quotes)
you can use:
f"{x}" #text without single quotes
f"'{x}'" #text with single quotes
this only works when you alternate quotes. like this: " ' ' " , ' " " '
f'"{x}"'
results in: '"1"' as output