Backslashes and forwardslashes getting mixed up in Python -


while programming in python, i've ran problem.

this line of code:

kickoff.write("rsyncbins\rsync --progress --recursive --delete --exclude rsyncbins/ --exclude etc/ --exclude logs/ --exclude screenshots/ --exclude uninstall.exe rsync://denver-1.download.toontownrewritten.com/ttr_win32/ .") 

this goes batch file, python thinks \ , / file paths , screws up. how can fix this?

i think problem introducing \r special character in string. backslash used escape characters, if want write "\r", have 2 options:

  • escape escape character. ie: rsyncbins\\rsync
  • tell python not escape anything. ie: kickoff.write(r"rsyncbins\rsync...")

there no reason python confused slashes, don't worry!


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -