test for raw string

John Hunter jdhunter at ace.bsd.uchicago.edu
Wed Feb 25 11:12:15 EST 2004


I have a function that takes a string as an argument.  Is there a way
to test whether the caller of this function passed in a raw string

def func(s):
    if israw(s): do_x()
    else: do_y()

func(r'\hi mom')  # do_x
func('hi mom')    # do_y

Thanks,
John Hunter




More information about the Python-list mailing list