Error when trying to do list compression with new lines Unterminated expression in f-string; missing close brace

Question:

test2 = [1,2,3,4,5]

print(f'The following Attributes are not supported n {"n".join([str(i) for i in test2])}')

Intended output:

The following Attributes are not supported
1
2
3
4
5

Is there any way I could achieve this whilst keeping it on the same line? The error received is as follows: Unterminated expression in f-string; missing close brace

Asked By: Br3xin

||

Answers:

You can use chr(10) instead of 'n':

print(f'The following Attributes are not supported n{chr(10).join([str(i) for i in test2])}')
Answered By: Unmitigated
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.