Skip to content

Latest commit

 

History

History
46 lines (28 loc) · 1.42 KB

README.md

File metadata and controls

46 lines (28 loc) · 1.42 KB

replace_last_backslash

Python package for replacing the last backslash '\' in a path string with a forward slash '/'. This is a toy project used to explore Python packaging, distribution, and deployment.

Installation

You can install the development version of the replace_last_backslash package from GitHub by following these steps:

  1. Clone the repository or download the source code from GitHub:
git clone https://github.com/your-username/replace_last_backslash.git

Replace your-username with your GitHub username.

  1. Navigate to the cloned or downloaded directory:
cd replace_last_backslash
  1. Install the package and its dependencies with poetry:
poetry install

Usage

Import the replace_last_backslash function from the replace_last_backslash module and use it in your Python scripts as follows:

from replace_last_backslash import replace_last_backslash

path = "C:the\\string\\in\\this\\path\\to\\fix.txt"
modified_path = replace_last_backslash(path)
print(modified_path) # Output: "C:the\\string\\in\\this\\path\\to/fix.txt"

The replace_last_backslash function takes a path string as input and returns the modified path string with the last backslash replaced by a forward slash. If the path does not contain any backslashes, it is returned as is.

License

This project is licensed under the GNU General Public License v3.0.