“Python wykonuje plik” Kod odpowiedzi

Uruchom plik PY w innym pliku PY

os.system('python my_file.py')
Tremendous Enceladus

Python wykonuje plik

import fileB #Replace fileB with the apportite file name
fileB.my_func() #Can replace 'my_fun' with a function from the second .py file
execfile('file.py') #Executes the .py file
Muddy Mamba

Uruchom plik Python za pomocą kodu Pythona

exec(open('file.py').read())
Blue Butterfly

Jak wykonać plik Pythona z innego pliku Pythona

import  myfile

myfile.myfunction


#calls a specific function from within the file


Muddy Monkey

Odpowiedzi podobne do “Python wykonuje plik”

Pytania podobne do “Python wykonuje plik”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu