burdier / pathpyhon

The easy way to deal with file paths on Windows, Mac and Linux, la manera correcta de trabajar con rutas en windows , mac y linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pathpyhon

The easy way to deal with file paths on Windows, Mac and Linux, la manera correcta de trabajar con rutas en windows , mac y linux

The Better Solution: Python 3’s pathlib!

Python 3.4 introduced a new standard library for dealing with files and paths called pathlib — and it’s great!

To use it, you just pass a path or filename into a new Path() object using forward slashes and it handles the rest:

from pathlib import Path

data_folder = Path("source_data/text_files/")

file_to_open = data_folder / "raw_data.txt"

f = open(file_to_open)

print(f.read())

https://medium.com/@ageitgey/python-3-quick-tip-the-easy-way-to-deal-with-file-paths-on-windows-mac-and-linux-11a072b58d5f

About

The easy way to deal with file paths on Windows, Mac and Linux, la manera correcta de trabajar con rutas en windows , mac y linux