Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

How to Import a Python Function from Another File

Автор: CodeFatherTech

Загружено: 2020-12-15

Просмотров: 97657

Описание:

Learn how to import a Python function from a different file than the one where your main application is coded.

This is a standard practice that allows defining common functions in a single file or module that can then be used by multiple Python programs using the import statement.

In this CodeFatherTech Python tutorial, we will also see the difference between "import {module}" and "from {module} import {function}".

And finally, we will use the Python sys module to add the absolute path where our functions file is located to the Python path.

--------- CHAPTERS ---------
(00:00:00) Create a sample Python program to explain the concepts related to Python import.
(00:01:16) Refactor the initial code using a function.
(00:02:30) Create a new Python file that will contain all the functions used by our program.
(00:03:00) Show how to use the Python import statement.
(00:04:25) Show how to use from ... import to import a specific Python function from another file.
(00:05:40) Import functions from a different file that is not in the same directory as your Python program.
(00:06:30) Use sys.path.append to add a directory to the Python path.

Also, after watching this tutorial let's build a cool game together in Python to keep improving your Python knowledge:
   • Code Your Own HANGMAN Game in Python Quick...  

Enjoy this tutorial and learn how to import a Python function from another file!
Claudio

#PythonProgramming #PythonTutorial #PythonForBeginners #CodeFatherTech

How to Import a Python Function from Another File

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Importing Your Own Python Modules Properly

Importing Your Own Python Modules Properly

25 привычек новичка в Python, от которых стоит избавиться

25 привычек новичка в Python, от которых стоит избавиться

Декораторы Python — наглядное объяснение

Декораторы Python — наглядное объяснение

Вот почему классы данных Python так хороши

Вот почему классы данных Python так хороши

Как бы я БЫСТРО выучил Python (если бы мог начать заново)

Как бы я БЫСТРО выучил Python (если бы мог начать заново)

How to Run a Python File Using Another Python File Using Subprocess (Very Easy)

How to Run a Python File Using Another Python File Using Subprocess (Very Easy)

Microsoft begs for mercy

Microsoft begs for mercy

Python For Beginners - Importing Functions From Another File Explained

Python For Beginners - Importing Functions From Another File Explained

Телеграм Бот на Python с нуля! | Telegram Bot на Aiogram для начинающих

Телеграм Бот на Python с нуля! | Telegram Bot на Aiogram для начинающих

Почему ваш код не соответствует Python (и как это исправить)

Почему ваш код не соответствует Python (и как это исправить)

Учебник Python для начинающих 9: Импорт модулей и изучение стандартной библиотеки

Учебник Python для начинающих 9: Импорт модулей и изучение стандартной библиотеки

Введение в Python Mocks | Учебник по Python

Введение в Python Mocks | Учебник по Python

Как бы я быстро выучил Python (если бы мог начать всё сначала)

Как бы я быстро выучил Python (если бы мог начать всё сначала)

Я ненавижу длинные цепочки If-Elif: этот шаблон проектирования решил эту проблему раз и навсегда

Я ненавижу длинные цепочки If-Elif: этот шаблон проектирования решил эту проблему раз и навсегда

Запросите данные API с помощью Python за 8 минут! ↩️

Запросите данные API с помощью Python за 8 минут! ↩️

How to Import a Python Function from Another File

How to Import a Python Function from Another File

Import modules in Python | Import module from different directory | Python Tutorial for beginners #5

Import modules in Python | Import module from different directory | Python Tutorial for beginners #5

Функции в Python — это просто 📞

Функции в Python — это просто 📞

Как бы я БЫСТРО выучил Python (если бы мог начать заново)

Как бы я БЫСТРО выучил Python (если бы мог начать заново)

Python Classes and Objects - OOP for Beginners

Python Classes and Objects - OOP for Beginners

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com