PYTHON_SOLVES Telegram 55
## Работа с путями (`os` и `pathlib`)

Тема:
Как узнавать и менять расположение файлов.

import os
from pathlib import Path

print(os.getcwd()) # текущая папка
os.mkdir("new_folder") # создать папку

path = Path("example.txt")
print(path.exists()) # True если файл есть
print(path.is_file()) # True если файл
print(path.is_dir()) # True если папка


Полезные советы:

* pathlib удобен для кроссплатформенной работы с путями.
* Проверяй существование файлов перед чтением.

#азы



tgoop.com/python_solves/55
Create:
Last Update:

## Работа с путями (`os` и `pathlib`)

Тема:
Как узнавать и менять расположение файлов.

import os
from pathlib import Path

print(os.getcwd()) # текущая папка
os.mkdir("new_folder") # создать папку

path = Path("example.txt")
print(path.exists()) # True если файл есть
print(path.is_file()) # True если файл
print(path.is_dir()) # True если папка


Полезные советы:

* pathlib удобен для кроссплатформенной работы с путями.
* Проверяй существование файлов перед чтением.

#азы

BY Python решает 🐍


Share with your friend now:
tgoop.com/python_solves/55

View MORE
Open in Telegram


Telegram News

Date: |

Joined by Telegram's representative in Brazil, Alan Campos, Perekopsky noted the platform was unable to cater to some of the TSE requests due to the company's operational setup. But Perekopsky added that these requests could be studied for future implementation. Over 33,000 people sent out over 1,000 doxxing messages in the group. Although the administrators tried to delete all of the messages, the posting speed was far too much for them to keep up. End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance. A Telegram channel is used for various purposes, from sharing helpful content to implementing a business strategy. In addition, you can use your channel to build and improve your company image, boost your sales, make profits, enhance customer loyalty, and more. Unlimited number of subscribers per channel
from us


Telegram Python решает 🐍
FROM American