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:
- Python: print syntax error: problem with invalid syntax error
- Solve the problem of syntax error: invalid syntax in PIP install XXX
- Error in PIP command execution – syntax error: invalid syntax
- Syntax error: invalid syntax
- Error syntax error: invalid syntax in PIP install XXX
- [Python] error syntax error: summary of solutions to invalid syntax
- Repo reports an error syntax error: invalid syntax
- Syntaxerror: invalid syntax when executing PIP install XXX
- Error reported in Python: syntax error: invalid character in identifier
- Invalid DN syntax (34)
- [Err] ERROR: invalid input syntax for integer: “1.0”
- SH script reports error “Eval: Line 1: syntax error: terminated quoted string”
- File “manage.py“, line 17 ) from exc ^ SyntaxError: invalid syntax
- Exception occurred when Django created app: from exc ^ syntaxerror: invalid syntax
- LDAP: error code 21 – objectclass: value ා 0 invalid per syntax
- Syntax error: invalid character in identifier
- Solution to syntaxerror: invalid syntax in PIP install XXX
- Syntax error, syntax expected name
- [!] Invalid `Podfile` file: syntax error, unexpected end-of-input, expecting keyword_end.