无法在 OSM 中为 png 图像选择名称 (python)

Cannot choose the name for a png image in OSM (python)

我正在尝试将使用 OSM 构建的路径保存为 png 图像,但我不知道如何输入此函数给出的名称(即文件名):

def plot_directions(graph, source_location, destination_location, directions, filename, width=400, height=400):
    ...
    image.save("filename.png")

文件名类似于filename = "city" 我知道这种方法不适合我的目的。我该怎么做? 谢谢

如果方法参数'fileName'是文件名,如fileName = "image.png", 您可以简单地调用它:

 image.save(filename)