Multiline f-string in Python
I think it would be
return f'''{self.date} - {self.time},
Tags: {self.tags},
Text: {self.text}'''
You can use either triple single quotation marks or triple double quotation marks, but put an f at the beginning of the string:
Triple Single Quotes
return f'''{self.date} - {self.time},
Tags:' {self.tags},
Text: {self.text}'''
Triple Double Quotes
return f"""{self.date} - {self.time},
Tags:' {self.tags},
Text: {self.text}"""
Notice that you don't need to use "\n" because you are using a multiple-line string.
From Style Guide for Python Code:
The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces.
Given this, the following would solve your problem in a PEP-8 compliant way.
return (
f'{self.date} - {self.time}\n'
f'Tags: {self.tags}\n'
f'Text: {self.text}'
)
Python strings will automatically concatenate when not separated by a comma, so you do not need to explicitly call join()
.