Python Forum
Changing Directory; Syntax Error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing Directory; Syntax Error
#2
Backslashes in string indicate special characters. \U indicates a unicode character. There are many possible solutions for this:
  • Put an r before the string (r'String\With\Backslashes'). That creates a raw string literal, that treats backslashes as plain characters.
  • Double backslash in a normal string is treated as a single backslash ('String\\With\\Backslashes').
  • Use Unix-style forward slashes. Python will translate it to the relevant file system syntax and it won't cause problems with special characters.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: Changing Directory; Syntax Error - by ichabod801 - Oct-08-2018, 02:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  World Clock syntax error OscarBoots 1 156 May-03-2024, 05:20 AM
Last Post: snippsat
  Syntax error for "root = Tk()" dlwaddel 15 1,286 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 435 Jan-19-2024, 01:20 PM
Last Post: rob101
  Syntax error while executing the Python code in Linux DivAsh 8 1,685 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Coding error. Can't open directory EddieG 6 1,156 Jul-13-2023, 06:47 PM
Last Post: deanhystad
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,487 Jun-27-2023, 01:17 PM
Last Post: diver999
  Code is returning the incorrect values. syntax error 007sonic 6 1,269 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 1,365 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Syntax error? I don't see it KenHorse 4 1,319 Jan-15-2023, 07:49 PM
Last Post: Gribouillis
  Syntax error tibbj001 2 938 Dec-05-2022, 06:38 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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