Write files outside of a docker container via python

  containers, docker, docker-machine, python, python-3.x

Is there a way to write files (json in this case) to outside of the docker container?
I’m taking about the most simple way, for example:

data = {"id":"1","name":"sample"}
with open('name.json','w,) as fp:

is there a way to make this write outside of the docker container? or in a specific place?
or to save it on a specific path on the system that the container will run on?

Source: Docker Questions