Telegram Group & Telegram Channel
This media is not supported in your browser
VIEW IN TELEGRAM
🖥 Совет по Python:


from pathlib import Path

# Создаем объект Path для заданного пути к файлу
path = Path("C:/Users/test.md")

# Получаем имя файла вместе с расширением
print(path.name) # 'test.md'

# Получаем только имя файла без расширения
print(path.stem) # 'test'

# Получаем расширение файла (с точкой)
print(path.suffix) # '.md'

# Получаем родительскую директорию (папку)
print(path.parent) # 'C:/Users'

С помощью модуля pathlib вы можете получать различные части пути — имя файла, расширение, родительскую директорию. Это упрощает работу с файловыми путями и их анализ.

Объяснение:

- path.name — возвращает полное имя файла (например, test.md).

- path.stem — возвращает имя файла без расширения (например, test).

- path.suffix — возвращает расширение файла (например, .md).

- path.parent — возвращает путь к родительской директории (например, C:/Users).

Модуль pathlib позволяет удобно разбирать путь к файлу на части и работать с ними, не используя строковые операции вручную. Это особенно полезно для кроссплатформенной работы с файлами и папками.

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/pythonl/4886
Create:
Last Update:

🖥 Совет по Python:


from pathlib import Path

# Создаем объект Path для заданного пути к файлу
path = Path("C:/Users/test.md")

# Получаем имя файла вместе с расширением
print(path.name) # 'test.md'

# Получаем только имя файла без расширения
print(path.stem) # 'test'

# Получаем расширение файла (с точкой)
print(path.suffix) # '.md'

# Получаем родительскую директорию (папку)
print(path.parent) # 'C:/Users'

С помощью модуля pathlib вы можете получать различные части пути — имя файла, расширение, родительскую директорию. Это упрощает работу с файловыми путями и их анализ.

Объяснение:

- path.name — возвращает полное имя файла (например, test.md).

- path.stem — возвращает имя файла без расширения (например, test).

- path.suffix — возвращает расширение файла (например, .md).

- path.parent — возвращает путь к родительской директории (например, C:/Users).

Модуль pathlib позволяет удобно разбирать путь к файлу на части и работать с ними, не используя строковые операции вручную. Это особенно полезно для кроссплатформенной работы с файлами и папками.

@pythonl

BY Python/ django


Share with your friend now:
tg-me.com/pythonl/4886

View MORE
Open in Telegram


Python django Telegram | DID YOU KNOW?

Date: |

Telegram auto-delete message, expiring invites, and more

elegram is updating its messaging app with options for auto-deleting messages, expiring invite links, and new unlimited groups, the company shared in a blog post. Much like Signal, Telegram received a burst of new users in the confusion over WhatsApp’s privacy policy and now the company is adopting features that were already part of its competitors’ apps, features which offer more security and privacy. Auto-deleting messages were already possible in Telegram’s encrypted Secret Chats, but this new update for iOS and Android adds the option to make messages disappear in any kind of chat. Auto-delete can be enabled inside of chats, and set to delete either 24 hours or seven days after messages are sent. Auto-delete won’t remove every message though; if a message was sent before the feature was turned on, it’ll stick around. Telegram’s competitors have had similar features: WhatsApp introduced a feature in 2020 and Signal has had disappearing messages since at least 2016.

The lead from Wall Street offers little clarity as the major averages opened lower on Friday and then bounced back and forth across the unchanged line, finally finishing mixed and little changed.The Dow added 33.18 points or 0.10 percent to finish at 34,798.00, while the NASDAQ eased 4.54 points or 0.03 percent to close at 15,047.70 and the S&P 500 rose 6.50 points or 0.15 percent to end at 4,455.48. For the week, the Dow rose 0.6 percent, the NASDAQ added 0.1 percent and the S&P gained 0.5 percent.The lackluster performance on Wall Street came on uncertainty about the outlook for the markets following recent volatility.

Python django from nl


Telegram Python/ django
FROM USA