I'm sure there's a good reason!

Tim Rowe digitig at cix.co.uk
Wed Mar 21 17:02:00 EST 2001


Can any of the assembled experts explain to me why:
	print r"\hello"
is fine, but
	print r"hello\"
isn't? In other words, why does the backslash escape quotes in a raw 
string? At one level I'm going to guess (without reading the spec) that 
it's because "that's what the spec says", but why? I thought the idea of 
raw strings was that they /didn't/ handle escapes!

TIA,

Tim




More information about the Python-list mailing list