Normally, you would just do:

s = s[:-3] + s[-2:]

The s[:-3] gives you a string up to, but not including, the comma you want removed ("this is a string") and the s[-2:] gives you another string starting one character beyond that comma (" a").

Then, joining the two strings together gives you what you were after ("this is a string a").

Answer from Anurag Uniyal on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_string_slice.asp
Python Slice Strings
Remove List Duplicates Reverse a String Add Two Numbers ยท Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... You can return a range of characters by using the slice syntax.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ string-slicing-in-python
String Slicing in Python - GeeksforGeeks
String slicing in Python is a way to get specific parts of a string by using start, end and step values. Itโ€™s especially useful for text manipulation and data parsing. ... Explanation: In this example, we used the slice s[0:5] to obtain the ...
Published: July 12, 2025
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_strings_slicing.asp
Python - Slicing Strings
Remove List Duplicates Reverse a String Add Two Numbers ยท Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... You can return a range of characters by using the slice syntax.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ how-to-index-and-slice-strings-in-python-3
How To Index and Slice Strings in Python | DigitalOcean
Learn how to index and slice strings in Python 3 with step-by-step examples. Master substring extraction, negative indexing, and slice notation.
๐ŸŒ
InterServer
interserver.net โ€บ home โ€บ python โ€บ how to slice strings in python: step-by-step tutorial
How to Slice Strings in Python: Step-by-Step Tutorial - Interserver Tips
April 23, 2026 - The step parameter lets you skip characters in a string. It is written as the third value in the slice: [start:stop:step]. For example, if text = "PythonProgramming", you can get every second character using:
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ python-slice-string
Python slice string | DigitalOcean
Technical tutorials, Q&A, events โ€” This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ built-in โ€บ slice
Python slice()
Online Python Online JavaScript ... Rust Online Scala Online Dart Online R Online Ruby ... The slice() function returns a slice object that is used to slice any sequence (string, tuple, list, range, or bytes)....
Find elsewhere
๐ŸŒ
LearnPython.com
learnpython.com โ€บ blog โ€บ string-slicing-in-python
String Slicing in Python: A Complete Guide | LearnPython.com
April 15, 2024 - Another way of slicing a string in Python is the slice() function. It returns a slice object representing the set of indices specified by start, stop, and step parameter. Slice objects contain a portion of a sequence.
๐ŸŒ
Real Python
realpython.com โ€บ lessons โ€บ string-slicing
String Slicing (Video) โ€“ Real Python
Python also allows a form of indexing syntax that extracts substrings from a string. Itโ€™s known as string slicing. The syntax that you use looks really similar to indexing. Instead of just one value being put in the square brackets, you put two withโ€ฆ
Published: October 1, 2019
๐ŸŒ
YouTube
youtube.com โ€บ watch
๐Ÿ Python Tutorial #26: String Slicing - YouTube
Learn how to master string slicing in Python with this easy-to-follow tutorial! String slicing allows you to extract parts of strings (substrings) using simp...
Published: June 28, 2025
๐ŸŒ
Learn By Example
learnbyexample.org โ€บ python-string-slicing
Python String Slicing - Learn By Example
April 20, 2020 - # Slice first three characters from the string S = 'ABCDEFGHI' print(S[:3]) # ABC
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_slicing_strings.htm
Python Slicing Strings
Python String slicing is a way of creating a sub-string from a given string. In this process, we extract a portion or piece of a string. Usually, we use the slice operator "[ : ]" to perform slicing on a Python String.
๐ŸŒ
Google
developers.google.com โ€บ google for education โ€บ python โ€บ python strings
Python Strings | Python Education | Google for Developers
Strings in Python are immutable, meaning new strings are created when modifications are needed. Characters and substrings can be accessed using zero-based indexing and the handy slice syntax.
๐ŸŒ
OpenStax
openstax.org โ€บ books โ€บ introduction-python-programming โ€บ pages โ€บ 8-2-string-slicing
8.2 String slicing - Introduction to Python Programming | OpenStax
March 13, 2024 - String slicing is used when a programmer must get access to a sequence of characters. Here, a string slicing operator can be used. When [a:b] is used with the name of a string variable, a sequence of characters starting from index a (inclusive) ...
๐ŸŒ
Linode
linode.com โ€บ docs โ€บ guides โ€บ how-to-slice-and-index-strings-in-python
How to Slice and Index Strings in Python | Linode Docs
January 28, 2022 - Python string indexing can also be used to extract a substring from a larger string. This process is referred to as slicing. To use Python to slice a string from a parent string, indicate the range of the slice using a start index and an end index.
๐ŸŒ
Python Central
pythoncentral.io โ€บ cutting-and-slicing-strings-in-python
Cutting and slicing strings in Python - Python Central
September 6, 2023 - For that reason, if you specify a negative stride, but omit either the first or second index, Python defaults the missing value to whatever makes sense in the circumstances: the start index to the end of the string, and the end index to the beginning of the string.
๐ŸŒ
Pierian Training
pieriantraining.com โ€บ home โ€บ string slicing in python: a beginnerโ€™s guide
String Slicing in Python: A Beginner's Guide - Pierian Training
April 28, 2023 - String slicing is a powerful feature in Python that allows us to extract a portion of a string. In Python, we can use square brackets and the colon (:) to slice a string.