python new line
# n Makes A new Line.
print("Hello n World!")
#Out Put
#Hello
# World!
#Still Counts The Space!
python new line
# n Makes A new Line.
print("Hello n World!")
#Out Put
#Hello
# World!
#Still Counts The Space!
f-string expression part cannot include a backslash
This is specified in the PEP for f-strings:
Backslashes may not appear inside the expression portions of f-strings, [...]
One option is assinging 'n' to a name and then .join on that inside the f-string; that is, without using a literal:
Example:
names = ['Adam', 'Bob', 'Cyril']
nl = 'n'
text = f"Winners are:{nl}{nl.join(names)}"
print(text)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us