Python Forum
can not change double to single dash
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can not change double to single dash
#6
Yes in the variable you see it as '\\' but it is '\' when you print it. Just like the new line character. It has no graphical representation as the letters for example so we use '\n' to deal with it. And because the single backslash is an escape character we have to escape it with another one. So:

s = '\\no \\new line here'
print(s)
Output:
\no \new line here
But see this:
print(len(s))
Output:
18
If you count the characters in the string you will get 20 but as you can see the output they are 18. '\\' is a representation of '\'. For our convenience.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
can not change double to single dash - by oco - May-27-2018, 08:40 AM
RE: can not change double to single dash - by oco - May-29-2018, 06:38 AM
RE: can not change double to single dash - by wavic - May-29-2018, 06:51 AM
RE: can not change double to single dash - by oco - May-30-2018, 07:09 AM
RE: can not change double to single dash - by wavic - May-30-2018, 07:26 AM
RE: can not change double to single dash - by oco - Jun-03-2018, 08:08 AM
RE: can not change double to single dash - by wavic - Jun-03-2018, 09:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Remove single and double quotes from a csv file in 3 to 4 column shantanu97 0 7,186 Mar-31-2021, 10:52 AM
Last Post: shantanu97
  Single digits seem to be greater than double digits Frosty_GM 4 3,756 Nov-20-2020, 10:13 AM
Last Post: DeaD_EyE
  create loop of subplot plotly dash without hardcode tonycat 0 4,010 Sep-23-2020, 08:40 AM
Last Post: tonycat
  How to update component props every time when a Dash callback returns? sguzunov 0 2,652 Jul-27-2020, 07:11 AM
Last Post: sguzunov
  Invalid archive error when attempting to install dash bootstrap components meaydemi 0 4,873 Jul-11-2019, 05:49 PM
Last Post: meaydemi
  how to use dataframe in dash? zhujp98 1 2,934 Jun-20-2018, 12:19 AM
Last Post: scidam
  dash problems zhujp98 0 2,310 Jun-14-2018, 03:30 PM
Last Post: zhujp98
  Change single element in 2D list changes every 1D element AceScottie 9 12,469 Nov-13-2017, 07:05 PM
Last Post: Larz60+
  Replace Single Backslash with Double Backslash in python saswatidas437 2 33,864 Mar-19-2017, 10:48 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

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