Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pyodbc
#5
(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.
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'
x[57] is the backslash just before "Users".

Thank you...
Reply


Messages In This Thread
pyodbc - by gmerritt - Feb-20-2022, 12:34 AM
RE: pyodbc - by ndc85430 - Feb-20-2022, 05:54 AM
RE: pyodbc - by ndc85430 - Feb-20-2022, 05:56 AM
RE: pyodbc - by gmerritt - Feb-21-2022, 02:22 PM
RE: pyodbc - by deanhystad - Feb-20-2022, 03:05 PM
RE: pyodbc - by gmerritt - Feb-21-2022, 02:04 PM
RE: pyodbc - by gmerritt - Feb-21-2022, 07:07 PM
RE: pyodbc - by gmerritt - Feb-21-2022, 02:07 PM
RE: pyodbc - by gmerritt - Feb-21-2022, 07:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using pyodbc&pandas to load a Table data to df tester_V 3 1,044 Sep-09-2023, 08:55 PM
Last Post: tester_V
  Formatting Data/Time with Pyodbc and openpyxl bearcats6001 0 2,369 Aug-17-2020, 03:44 PM
Last Post: bearcats6001
  Get database used data space from pyodbc susja 1 2,367 Aug-14-2020, 02:01 PM
Last Post: susja
  pyodbc error ('82', '[82] 523 80 (0) (SQLDriverConnect)') paulsuk1982 1 2,279 Nov-29-2019, 11:05 AM
Last Post: Larz60+
  pyodbc.Error SQLBindParameter pcarra 0 4,052 Jul-08-2019, 08:22 PM
Last Post: pcarra
  Pyodbc error taxit 1 5,326 Jun-18-2019, 01:13 AM
Last Post: Larz60+
  Using VBA to Call a Python script causes error in pyodbc connector pcarra 1 2,955 Jun-11-2019, 04:14 PM
Last Post: pcarra
  Split List and Sublist from Pyodbc parthi1705 1 2,321 May-05-2019, 10:44 AM
Last Post: Larz60+
  Problem with pyodbc executemany() RBeck22 1 7,610 Apr-02-2019, 06:12 PM
Last Post: micseydel
  PyODBC error - second parameter to executemany must be a sequence, iterator, or gener RBeck22 1 7,271 Mar-29-2019, 06:44 PM
Last Post: RBeck22

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020