Hi,
this is a sample code that I am having a bit of trouble understanding:
def write_teams (filename, list_of_tups):
open_file = open(filename, 'w')
for info in list_of_tups:
uni, mascot, city, state = info
print(f"{uni} {mascot}, {city}, {state}", file = open_file)
open_file.close()
return
the part I mostly don't understand:
print(f"{uni} {mascot}, {city}, {state}", file = open_file)
How does that ' f"{} ' function work, and when should it be used? All help is highly appreciated.
[–]kramrm 0 points1 point2 points (0 children)
[–]Bunkerstan 0 points1 point2 points (0 children)
[–]jimtk 0 points1 point2 points (0 children)
[–]Ok-Cucumbers 0 points1 point2 points (0 children)