![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
|
\ as a character, not escape sequence
I am parsing a text file and during the process I need to check for a '\'. Python of course thinks I am trying to use the escape sequence. Any way around this?
Here is some example code: if self.data[index] == '\': print "Detected a backslash" |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Use "\\". That will give you a single, literal backslash.
|
|
|
|
|
|
#3 |
|
Programmer
|
Thanks so much!
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading character input into an array (raw mode) | shoeyfighter | C | 3 | Nov 2nd, 2006 3:49 PM |
| incrementing character array elements value | n00b | C++ | 7 | Jun 24th, 2006 3:44 AM |
| character escape code question | angry_asian | Java | 2 | Jun 19th, 2006 6:28 PM |
| generating character sequence | Gumby | Java | 12 | Jun 14th, 2006 7:46 AM |
| Printing escape sequences using printf()? | bivhitscar | C | 5 | Nov 3rd, 2005 10:08 PM |