Questions tagged [pathlib]

This tag is for questions about the Python built-in library pathlib, which offers classes representing filesystem paths with semantics appropriate for different operating systems.

This module offers classes representing filesystem paths with semantics appropriate for different operating systems. Path classes are divided between Pure paths, which provide purely computational operations without I/O, and Concrete paths, which inherit from pure paths but also provide I/O operations.

Its strength lies in that it offers a powerful Object Oriented interface for working with paths, as opposed to the string-based interface offered by os.path.

This table offers a mapping between various os functions to their corresponding PurePath/Path equivalent.

635 questions
-2
votes
1 answer

Converting multiple CSVs to TSVs using Python

Trying to convert multiple (5) CSVs to TSVs using python, but when I run this it only creates 1 TSV. Can anyone help? import csv import sys import os import pathlib print ("Exercise1.csv"), sys.argv[0] dirname =…
amb
  • 27
  • 6
-3
votes
2 answers

Why I am not getting into the path file " the system cannot find the path specified "

So I am using a function in python which is being called in Robotframework to copy a file from a source to destination I have used os.path.join() and os.listdir() and os.path.normpath() to get access to the folder and copy using shutil But…
Raja_Viki
  • 13
  • 2
-6
votes
2 answers

Adding a suffix to a full path's name, before the extension

I am moving some of my code from os.path to pathlib.Path and found that in general it is much better. On a specific task I found that actually os.path might be more comfortable to use. I want to create a new path from a given one, by adding a suffix…
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
-7
votes
2 answers

How to get a specific parent of a path by its name?

I have a function that returns the full path of a specific parent that I look for by a constant name. I am currently using os.path and strings for paths so right now this is done with regular-expressions. What I want is for example for a constant…
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
1 2 3
42
43