dkuhlman at rexx.com
Sun Jul 8 22:16:14 CEST 2007
On Sun, Jul 08, 2007 at 10:54:51AM -0600, max . wrote:
> hello i am writing a simple password tester that uses a word list and am
> running into some problems when i read the words from a text file they are
> written to the screen with a backslash at the end and i cant seem to find a
> way to get rid of them
In Python, the backslash is a character escape character. In order
to include a backslash in a string, use a double backslash. Here
is some example code::
In : s1 = 'abcd\\efg\\'
In : s1
In : len(s1)
In : s1.replace('\\', '')
Notice the length of the string (before removing the backslashes).
Each apparently double backslash actually has a length of 1.
More information about the Tutor