Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
escape single quote
#2
For this type of stuff, it's best to use os's path.join. Example:
import os

textDoc = os.path.join('C:', 'users', 'user1', 'desktop', 'stuff', 'test.txt')

I you want to use single quotes you can do the following:
path = r'C:\users\user1\desktop\\'
Reply


Messages In This Thread
escape single quote - by deep_logic - Sep-10-2019, 06:30 PM
RE: escape single quote - by SheeppOSU - Sep-10-2019, 08:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  use of escape character in re.sub and find WJSwan 1 930 Feb-16-2023, 05:19 PM
Last Post: Larz60+
  python sql query single quote in a string mg24 1 1,084 Nov-18-2022, 08:01 PM
Last Post: deanhystad
  Escape indentation Frankduc 11 3,094 Jan-31-2022, 02:41 PM
Last Post: Frankduc
  add Escape charcters in string GrahamL 3 1,192 Jan-20-2022, 01:15 PM
Last Post: GrahamL
  Escape Single quotation between each content tag usman 3 2,830 May-02-2021, 03:32 PM
Last Post: snippsat
  DIY Escape Room for fun StannemanPython 1 2,325 Feb-17-2021, 10:53 PM
Last Post: maurom82
  How to escape OrderedDict as an argument? Mark17 2 2,040 Dec-23-2020, 06:47 PM
Last Post: Mark17
  How to double quote filenames (spaces)? Winfried 2 3,493 Jan-25-2020, 09:39 PM
Last Post: Winfried
  help for escape sequences NewPi 1 2,043 Dec-11-2019, 11:22 PM
Last Post: ichabod801
  The use of escape char \ hishamzero1 2 2,390 Aug-12-2019, 10:20 PM
Last Post: hishamzero1

Forum Jump:

User Panel Messages

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