Python Forum
i'm back to f-strings, again
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i'm back to f-strings, again
#3
yeah, the file will have the same kind of thing as you see between quotes of an f-string literal but it would not be a literal. i cannot remember where i read this but i read that there was a way to pass such a string to some method called format that would format it in the specified/given context. it have looked at the description of the builtin format() but it does not seem to have a way to execute a snippet (stuff between {}) that is executable code. so i can put a var name in there but not an expression.

i can do what i want in Bash using the eval command. i just need to put '$' in front of the { for each snippet and make it run in a way that it captures the evaluation into a string. i have done the bash thing before.

but i now want to do this in Python.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
i'm back to f-strings, again - by Skaperen - Sep-20-2022, 06:10 PM
RE: i'm back to f-strings, again - by rob101 - Sep-20-2022, 09:16 PM
RE: i'm back to f-strings, again - by Skaperen - Sep-21-2022, 01:47 AM
RE: i'm back to f-strings, again - by bowlofred - Sep-21-2022, 03:10 AM
RE: i'm back to f-strings, again - by Gribouillis - Sep-21-2022, 08:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand strings and lists of strings Konstantin23 2 953 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 1,932 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  Back again on f-strings newbieAuggie2019 11 4,752 Oct-16-2019, 11:24 PM
Last Post: newbieAuggie2019
  Finding multiple strings between the two same strings Slither 1 2,643 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  lists, strings, and byte strings Skaperen 2 4,370 Mar-02-2018, 02:12 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020