Python Forum
printing an string instead of a expression
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
printing an string instead of a expression
#1
i want to print literally the string "\n", not the expression \n
how would i do that?
Reply
#2
print('\\n')
Underscore likes this post
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#3
Or you can use a raw string.
print(r'I want to see a \n and not have it be a line feed')
A problem with the raw string is it disables all escape sequences in the string.
Underscore likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing a raw string with a folder separator at the end, duplicates the separator krulah 5 1,206 Nov-28-2022, 12:41 PM
Last Post: snippsat
  printing a string in reverse Skaperen 2 1,540 Nov-20-2021, 05:08 AM
Last Post: ghoul
  Regular expression: cannot find 1st number in a string Pavel_47 2 2,406 Jan-15-2021, 04:39 PM
Last Post: bowlofred
  Regular expression: return string, not list Pavel_47 3 2,489 Jan-14-2021, 11:49 AM
Last Post: Pavel_47
  Printing string at specific position on terminal - not showing __Mathieu__ 1 2,370 Sep-07-2020, 10:32 AM
Last Post: Larz60+
  Pass results of expression to another expression cmdr_eggplant 2 2,273 Mar-26-2020, 06:59 AM
Last Post: ndc85430
  printing a bytes string Skaperen 2 2,353 Jul-21-2019, 03:42 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020