473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How do I express a backslash in a string?

>>"'"
"'"
>>"\'"
"'"
>>"\\'"
"\\'"
>>"\\\'"
"\\'"
>>>
This is quite different than any other language
that I am used to. Normally, a double backslash
takes away the special meaning of the last backslash,
and so you are left with a single backslash.

How do I express the single backslash?

Thanks,

Tobiah

--
Posted via a free Usenet account from http://www.teranews.com

Aug 22 '07 #1
2 2146
Tobiah wrote:
>>>"'"
"'"
>>>"\'"
"'"
>>>"\\'"
"\\'"
>>>"\\\'"
"\\'"
>>>>

This is quite different than any other language
that I am used to. Normally, a double backslash
takes away the special meaning of the last backslash,
and so you are left with a single backslash.

How do I express the single backslash?

Thanks,

Tobiah
A little more looking, and I see:

>>"\\'"
"\\'"
>>len("\\'")
2
>>>

So it was just the console representation that was fooling
me into thinking that I had a double backslash.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 22 '07 #2
On Aug 22, 1:19 pm, Tobiah <t...@tobiah.orgwrote:
>"'"
"'"
>"\'"
"'"
>"\\'"
"\\'"
>"\\\'"
"\\'"

This is quite different than any other language
that I am used to. Normally, a double backslash
takes away the special meaning of the last backslash,
and so you are left with a single backslash.

How do I express the single backslash?

Thanks,

Tobiah
It IS a single backslash - the interpreter in interactive mode
displays the string literal (escaped) version of what you entered,
which is, well, what you entered. If you print it instead, you'll see
the actual string value.
>>'\\'
'\\'
>>print '\\'
\

Fred

Aug 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Vincent Texier | last post by:
Hello, I want to send 3 chars in hexa code to the serial port. So I type in a tkinter entry : "\x20\x01\x21" The string is set in a StringVar(). When I read the stringVar, I get :...
3
by: Terry Asher | last post by:
The following script does NOT escape the Apostrophe. Meaning when you mouseover the image the Alt tag says this: DMACC, It and then it stops. <SCRIPT Language="JavaScript"> var pos = "DMACC,...
6
by: John Salerno | last post by:
I have this: subdomain = raw_input('Enter subdomain name: ') path = r'C:\Documents and Settings\John Salerno\My Documents\My Webs\1and1\johnjsalerno.com\' + subdomain Obviously the single...
2
by: John Dann | last post by:
I guess there must be some convention or Windows specification for whether the backslash immediately preceding the file name in a full path string to a file is formally part of the path string or...
8
by: Wijaya Edward | last post by:
Hi all, I was trying to split a string that represent chinese characters below: ??? But why the split function here doesn't seem
5
by: shalini jain | last post by:
Hi, I want to know how to use split function to split the string based on backslash(\). Actually backslash is appearing at the end of the string. and i want to remove it. so if anyone could guide...
3
by: Stef Mientki | last post by:
It looks like sometimes a single backslash is replaced by a double backslash, but sometimes it's not ??? See the error message below, the first backslash is somewhere (not explicitly in my code)...
5
by: vlsidesign | last post by:
The printf function returns "warning: unknown escape sequence: \040" for a backslash-space combination. If the ascii decimal number for space is 32 and the backslash is 92, why this particular...
1
by: Dravidan | last post by:
I am trying to read some byte data as a string then using a library to convert them a code: My table contains: \x00\x00,0000 \x01\x00,0000 .......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.