diff --git a/python-strip/README.md b/python-strip/README.md index f93c0e386b..1688c31c9b 100644 --- a/python-strip/README.md +++ b/python-strip/README.md @@ -1,6 +1,6 @@ # How to Strip Characters From a Python String -This folder contains code snippets from the Real Python tutorial on [How to Strip Characters From a Python String](https://realpython.com/how-to-use-python-strip-remove-characters/). +This folder contains code snippets from the Real Python tutorial on [How to Strip Characters From a Python String](https://realpython.com/python-strip/). ## License diff --git a/python-strip/remove_suffix.py b/python-strip/remove_suffix.py index fab134411c..8eddc80a54 100644 --- a/python-strip/remove_suffix.py +++ b/python-strip/remove_suffix.py @@ -3,7 +3,7 @@ filename = "txt_transcript.txt" # Incorrect: .strip() doesn't remove sequences -print(filename.strip("txt_")) +print(filename.strip(".txt")) # Correct: Use .removesuffix() for this task print(filename.removesuffix(".txt")) diff --git a/python-strip/username.py b/python-strip/username.py index 410c56315b..912f46118c 100644 --- a/python-strip/username.py +++ b/python-strip/username.py @@ -1,4 +1,4 @@ -submitted_username = "_!__YoJohnDoe!__!!" +submitted_username = "_!__Yo_JohnDoe!__!!" cleaned_username = submitted_username.strip("!_") print(cleaned_username)