Using Git files in Python (انتشار: 1402/07/04)

One of the ways to store project files and functions in different versions is GitHub. Now, if we want to reuse these files in our own Python projects, we need a functional script. which we will get to know later.

این چیه؟

We consider three steps for this. We have to clone the relevant repository from Git. Move the relevant folder or files out of it and delete the folder containing the extra files. Finally, call the existing functions. Since these codes are different for Windows and Linux, we will present them separately as a practical example.

#Windows OS
import os
os.system("git clone https://github.com/dmahdipour/pytorch")
os.system("move pytorch/py_functions .")
os.system("rmdir /s /q pytorch")
from py_functions import data_setup, engine)

 

#Linux OS
import os
os.system("git clone https://github.com/dmahdipour/pytorch")
os.system("mv pytorch/py_functions .")
os.system("rm -rf pytorch")
from py_functions import data_setup, engine


نظرات خوانندگان نوشته


نظری در این مورد دارید؟ خوشحال می‌شیم اون رو برامون ارسال کنید.