Feb-21-2022, 02:04 PM
(Feb-20-2022, 03:05 PM)deanhystad Wrote: I wanted to see what unicode characters are at positions 57-58. To disable treating "\" as part of an escape sequence I used the "r" prefix to make this a "raw" string.
x[57] is the backslash just before "Users".
Output:>>> x = r"DRIVER={SQLite3 ODBC Driver};SERVER=localhost;Database=C:\Users\GM\CALL_SIGN_DATABASE1.db;Trusted_connection=yes" This modifies the str, replacing "\" with "\\". This is how you tell Python that a backslash is just a backslash and not an escape sequence. 'DRIVER={SQLite3 ODBC Driver};SERVER=localhost;Database=C:\\Users\\GM\\CALL_SIGN_DATABASE1.db;Trusted_connection=yes' >>> x[56:] ':\\Users\\GM\\CALL_SIGN_DATABASE1.db;Trusted_connection=yes'
Thank you...