The first backslash is an escape character, just like when you type \n you are escaping the character n and qualifying that it's a newline. So say you had for example mydir\name in your directory string (or any string for that matter) you then have to escape the \ character to tell it you just want the backslash.
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: