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.
🌐
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.
🌐
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:
🌐
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.
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › string slicing in python
String Slicing in Python | phoenixNAP KB
October 24, 2023 - A terminal or IDE to run the code. ... The slice() method splits the array according to the provided range parameters. The array slicing notation performs the same task as the <strong>slice()</strong> method, but uses different notation.
🌐
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.
🌐
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 - The simplest way of extracting single characters from strings (and individual members from any sequence) is to unpack them into corresponding variables. [python] >>> s = 'Don' >>> s 'Don' >>> a, b, c = s # Unpack into variables >>> a 'D' >>> b 'o' >>> c 'n' [/python]
🌐
freeCodeCamp
freecodecamp.org › news › python-substring-how-to-slice-a-string
Python Substring – How to Slice a String
July 27, 2021 - You can use the find() method to check if a substring is present in the string. ... If it's available it returns the left-most index of the substring, otherwise it returns -1 (which means it's not available). Here the output is -1, which means “zz” is not present in “hello world”. You can choose to slice a specific character according to its index number.
🌐
Python Guides
pythonguides.com › slicing-string-in-python
How to Perform String Slicing in Python
September 16, 2025 - Instead of writing loops or extra logic, you can use slicing to quickly grab the exact part of the string you need. For example, if I have the string “PythonGuides”, I can slice “Python” or “Guides” with just a few keystrokes.