Sep-21-2020, 06:48 PM
1) Is the following changes to new style of Python Formatting correct? And if not, what is a better way to efficiently format by reduce no. of lines, etc.
2) For example, there is the f-string method. When is the best scenario to use each formatting method?
OLD STYLE
2) For example, there is the f-string method. When is the best scenario to use each formatting method?
OLD STYLE
return "%s %s\n%s"%(self.salutation,self.name,self.address)NEW STYLE
return "{} {}\n{}"%(self.salutation,self.name,self.address)