0

very new to python so sorry for the silly question

I've created a user input interface

fn=input() 
#Where the user will input version32 for instance so effectively
fn=Version32

I've then imported a template word document using docx, which has been heavily modified based upon user input. I then want the file name output to be saved as "fn" or in this case Version32

output.save(r"C:\Users\XXX\XXX\XXX\'fn'.docx")

Where fn is a variable? Is this even possible, or am I barking up the wrong tree?

Kind Regards!!

JohnTheBadge
  • 67
  • 1
  • 7

1 Answers1

2

IIUC, you can do this using f-string:

output.save(rf"C:\Users\XXX\XXX\XXX\{fn}.docx")
NYC Coder
  • 7,424
  • 2
  • 11
  • 24