How do I represent Carriage Return in this funny language ???

Ian Bicking ianb at colorstudy.com
Wed Feb 5 02:05:34 EST 2003


On Wed, 2003-02-05 at 00:53, Joseph wrote:
> QUESTION:  How do I check for Carriage Return ?
>   I've tried  :   if ( oper == '\n')
>                 , if ( oper == "\n")
>                 , if ( oper == chr(15))    ## 15 is ASCII of CR

I think you are looking for "\r" -- \n is newline, \r is CR.  The ASCII
number of \r is 13, or 015 in octal, so chr(015) == char(13) == "\r" ==
"\15".

-- 
Ian Bicking  ianb at colorstudy.com  http://colorstudy.com
4869 N. Talman Ave., Chicago, IL 60625  /  773-275-7241
"There is no flag large enough to cover the shame of 
 killing innocent people" -- Howard Zinn





More information about the Python-list mailing list