TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #198 · 6 јан.

Первая директория в sys.path 🔸 Когда вы запускаете Python-интерпретатор в интерактивном режиме, в системные пути (sys.path) в самое начало добавляется текущая рабочая директория >>> for path in sys.path: ... print(f'"{path}"') "" "/usr/lib/python37.zip" "/usr/lib/python3.7" ... Первая строка пустая, что и означает текущую рабочую директорию. 🔸 Если вы запускаете интерпретатор передавая скрипт как аргумент, то история получается иная. На первом месте будет директория в которой располагается скрипт. А текущая рабочая директория игнорируется. Пишем скрипт с таким содержанием: # script.py import sys for path in sys.path: print(f'"{path}"') Запускаем python3 /home/user/dev/script.py Получаем "/home/user/dev" "/usr/lib/python37.zip" "/usr/lib/python3.7" ... 🔸 Если вы запускаете скрипт по имени модуля то на первом месте будет домашняя директория текущего юзера python3 -m script "/home/user" "/usr/lib/python37.zip" "/usr/lib/python3.7" ... Скрипт должен быть доступен для импорта На что это влияет? На видимость модулей для импорта. Если вы ждёте, что, запустив скрипт по пути, сможете импортировать модули из текущей рабочей директории, то вы ошибаетесь. Придётся добавлять путь os.getcwd() в sys.path самостоятельно или заранее объявлять переменную PYTHONPATH. #basic

Hashtags

Резултати

Пронајдени 9 слични објави

Пребарај: #inspirational

当前筛选 #inspirational清除筛选
₿usiness Tips | Thoughts 💡

@quotesofzday · Post #269 · 07.08.2022 г., 12:01

Remember, Most of your stress comes from the way you respond, not the way life is. Adjust your attitude. Change how you see things. Look for the good in all situations. Take the lesson and find new opportunities to grow. Let all the extra stress, worrying, and overthinking go. #Inspirational

₿usiness Tips | Thoughts 💡

@quotesofzday · Post #268 · 07.08.2022 г., 11:59

Prioritize your mental and spiritual wellness. Do things that make you happy. Take time to nurture yourself. Don’t rush the process. Don’t judge where you’re at or where you think you should be. Just be kind and patient with yourself. Things are unfolding for you. #Inspirational

₿usiness Tips | Thoughts 💡

@quotesofzday · Post #258 · 05.08.2022 г., 16:01

Wrinkles, scars, imperfections, strengths, & weaknesses - all these made you who you are today - a strong, independent, beautiful human being. Embrace it all with gratitude. When you learn to accept & love everything about you, nobody can ever use it against you. #Inspirational

Quiet World 🍁

@QuietWorld · Post #7360 · 08.06.2020 г., 03:15

“𝕋𝕠 𝕤𝕦𝕔𝕔𝕖𝕖𝕕, 𝕪𝕠𝕦 𝕨𝕒𝕟𝕥 𝕥𝕠 𝕓𝕖 𝕒𝕓𝕝𝕖 𝕥𝕠 𝕣𝕖𝕘𝕦𝕝𝕒𝕥𝕖 𝕪𝕠𝕦𝕣 𝕚𝕞𝕡𝕦𝕝𝕤𝕖𝕤 𝕨𝕙𝕚𝕝𝕖 𝕒𝕝𝕤𝕠 𝕙𝕒𝕧𝕚𝕟𝕘 𝕥𝕙𝕖 𝕚𝕞𝕒𝕘𝕚𝕟𝕒𝕥𝕚𝕠𝕟 𝕥𝕠 𝕤𝕖𝕖 𝕨𝕙𝕒𝕥 𝕥𝕙𝕖 𝕗𝕦𝕥𝕦𝕣𝕖 𝕨𝕚𝕝𝕝 𝕓𝕖 𝕝𝕚𝕜𝕖 𝕚𝕗 𝕪𝕠𝕦 𝕥𝕣𝕪 𝕤𝕠𝕞𝕖𝕥𝕙𝕚𝕟𝕘 𝕟𝕖𝕨.” #selfreminder#motivation#inspirational#life#wisdom#success @quietworld🍃