[Tutor] Re: all the slashes

Andrei project5 at redrival.net
Mon Feb 9 12:41:00 EST 2004


Gerhard Venter wrote on Fri, 06 Feb 2004 16:23:21 +0000:

> I use the code below in Python 2.3, but in 2.2 it says:
> TypeError: 'in <string>' requires character as left operand
> I have tried r'//',  and '////' (to escape the slashes) to no avail.  
> How can I make this work in 2.2?
> 
>      myfile=open(r'/etc/sitelist','a')
>      if "//" in mystring:

Use the find() method of mystring.


-- 
Yours,

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq
gur yvfg, fb gurer'f ab arrq gb PP.




More information about the Tutor mailing list