6 examples of 'pathlib get filename' in Python

Every line of 'pathlib get filename' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
66def get_file_path(filename):
67 """
68 Find the book_title excel file path.
69 """
70 root_dir = d(d(abspath(__file__)))
71 root = Path(root_dir)
72 filepath = root / 'stateful_book' / filename
73 return r'{}'.format(filepath)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

36def get_path(filename):
37 return os.path.join(os.path.dirname(__file__), 'test_data', filename)
19def get_file(filename):
20 """Return the path of a test file."""
21 return os.path.join(TEST_DIR, filename)
9def get_path(dir, filename):
10 return os.path.join(
11 os.path.dirname(__file__),
12 dir, filename
13 )
50def get_file_path(): # pragma: no cover
51 commiter = Path('commiter.yml')
52 commit_h = Path('commit-helper.yml')
53
54 if commiter.exists():
55 return commiter
56 else:
57 return commit_h
83def _get_file_path(filename=""):
84 """
85 Return the full path of a data-file for the data-set.
86
87 If filename=="" then return the directory of the files.
88 """
89
90 return os.path.join(data_path, "cifar-10-batches-py/", filename)

Related snippets