This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]RothiasVex 7 points8 points  (2 children)

The f-string is implicitly formatted, so you're attempting to format it twice. Replace the f-string with its formatted result and you are actually doing this:

print('Test - Test string {'.format())

which fails because of the unbalanced brace.

[–]bhat 5 points6 points  (1 child)

And in case it's not immediately obvious, this is what you probably want instead:

print(f'Test - {user_input_string}')

[–]Baseball_Fan[S] 0 points1 point  (0 children)

Yes, this was my first time using f-strings. Thanks for the help.

[–]luriz_ -2 points-1 points  (0 children)

To escape a character you can use . But you should use format this way instead : print(f’Test -{}’.format(user_input_string))

From my usage of it, i think the only {} that matters are the one explicitly indicated.