Maybe try
from functools import partial
and use
Button(master, text=i, command=partial(opendoc, i))
The partial object is created using the current value of i, whereas the lambda uses a reference to the variable i in the enclosing scope, whose value can change. Or something like that.
I always find myself using partial with tkinter.