0

I'm trying to make a cross-platform program that move a file to a folder inside the user home folder, like this:

os.rename(file_var, destination_folder)

but I can't make it work because I need to put the file name inside the destination var, and the problem is the Windows "\"

what are my options?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

do this: for example you want this path:

'+pathfile+'/output/log.txt'

instead of typing a string, join them like this:

os.path.join(pathfile,"output","log.txt")

NOTE:

according to this post / works both in windows and linux, i always use os.path.join()

BlooB
  • 955
  • 10
  • 23