Syntax error: invalid syntax before Python string

The usage of adding f before Python string

 

import time
t0 = time.time ()
time.sleep (1)
name = ‘processing’

#Starting with {f} indicates that Python expressions in braces are supported in strings
Print (f ‘{name} done in{ time.time () – t0:.2f} s’) 

Output:
processing done in 1.00 s

 

Why report a mistake

This usage is only used after 3.6. Mine is Python 3.5, which is so direct and simple

resolvent

What’s the way?Of course, it’s anaconda


Read More: