
CodePudding user response:
Four five lines are just two kinds of format string syntax, the fourth line is relatively common, the fifth line is later new syntaxPrint it at the same time, the first printed out, file read pointer has moved to the final, so print is empty again
Can the fourth row behind add a
f_name. Seek (0)try
CodePudding user response:
Thank you, I try, the fifth line grammar don't understand, more to seeCodePudding user response:
Thank you, I try, the fifth line grammar don't understand, more to seeCodePudding user response:
The fifth line of code is a string formattingLike % s
Here just use is {}, then add f in front of the string, and then want to pass parameters in curly braces
A='hello'
B=f '{a} world! '
Print (b)
Output # # # # # # # # # #
hello world!
In addition to know the format string formatting methods that may be more easy to understand
CodePudding user response:
This starts a new string formatting python3.6 way f - string.The inside of the curly braces is replaceable
CodePudding user response:
Thanks, I don't know