How to save tem file in my system with python

i try to add geometry layer to my gis app from shb layer i use Django for doing that and for uploading file i use serializer FileField now my main question is How can i save temporary file to my system in python is there any way to do that?

if there is please help me about that

Here is a similar question that has already been answered.

TL/DR

import tempfile

with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
    f.write("hello world")

path_to_tempfile = f.name
Back to Top