0

Hello I was working on a project but I am stuck on concatenating two variable to a path for an ftp upload, So can you please help

import os
login=os.getlogin()
fname=str(filenum)+".txt"
fh = open(r"C:\Users\LOGIN HERE\AppData\Local\Google\Chrome\User Data\Default\FNAME HERE", 'rb')

Thanks!

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Mattz Manz
  • 43
  • 2
  • 7

1 Answers1

0

os.path.join should do the trick (although it's a bit of overkill here):

fh = open(os.path.join(r"C:\Users", login, "AppData\Local\Google\Chrome\User Data\Default", fname), 'rb')
Mureinik
  • 297,002
  • 52
  • 306
  • 350