Reputation: 438
I have read How do I un-escape a backslash-escaped string in python? (How do I un-escape a backslash-escaped string in python?) and the answer doesn't work, perhaps because I'm running Windows.
In [1]: sql = '''
SELECT {column_specs}
FROM {tables}
WHERE year = {year} AND game_ref = games.id AND
{id_matches} AND
EVENT_CD IN ({event_codes})'''
In [2]: sql.decode('string_escape')
Out[2]: '\nSELECT {column_specs}\n FROM {tables}\n WHERE year = {year} AND game_ref = games.id AND\n {id_matches} AND\n EVENT_CD IN ({event_codes})'
Upvotes: 0
Views: 145
Reputation: 21466
Try
print sql.decode('string_escape')
Output
SELECT {column_specs}
FROM {tables}
WHERE year = {year} AND game_ref = games.id AND
{id_matches} AND
EVENT_CD IN ({event_codes})
Upvotes: 2