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

Padraig at Linux.ie Padraig at Linux.ie
Wed Feb 5 12:00:57 CET 2003


Joseph wrote:
> Hi,
> 
> I am quite new to PYTHON.

and to programming? :-)

> Anyway, I need to make a string/character comparison in an 'if' statement.

note brackets usually aren't required in python,
so it would be something like

  if char == '\r':

> Goes like this :
>    if ( oper == "jxredi" )

not sure why this is here, did you mean
  if oper in "jxredi":

> 
> 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

  if char == '\r':
  if char == "\r":
  if char == chr(13):
  if char == chr(015):
  if char == '\15':
  if char == '\15':
  if char == chr(0xd):
  if char == '\x0d':

Pádraig.





More information about the Python-list mailing list