You currently are replacing those values with the literal name of the variable. If you want it to use the values that those variable names refer to, omit the quotes.
Next, you'll have to turn those variables into strings, because I suspect that the reason you used quotes in the first place was because you got an error without them, as well. This is because replace
takes only strings, and your variables are tuple
s. To fix this, cast the variable to a string.
filedata = filedata.replace('box_lat', str(box1))
If you don't want to keep the parentheses that appear in a string representation of a tuple
, you can strip them off:
filedata = filedata.replace('box_lat', str(box1).strip('()'))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…