test = ["80010","80030","80050"]
newtest = [x[:-1] for x in test]

New test will contain the result ["8001","8003","8005"].

[x[:-1] for x in test] creates a new list (using list comprehension) by looping over each item in test and putting a modified version into newtest. The x[:-1] means to take everything in the string value x up to but not including the last element.

Answer from Matthew on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-remove-last-character-in-list-of-strings
Python | Remove last character in list of strings - GeeksforGeeks
May 18, 2023 - Combine the modified first string with the modified rest of the input list and return it. ... # Python3 code to demonstrate # remove last character from list of strings # using recursive function def remove_last_char(lst): if not lst: # base ...
Discussions

python - Remove final character from string - Stack Overflow
In this method, input_str.rspl... in a list of substrings. Then, ''.join() concatenates those substrings back into a single string without the last character. The resulting string is stored in output_str. This approach may be useful if you want to remove only the last occurrence of a specific character from the string, ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
5 Ways You Can Remove Last Character From String in Python
Method 1 and 2 are the same, except that defining a variable that doesn't do anything but hold the length of string 1 is even a bit more inefficient than method 1. Importing the re module to remove a character from a string is just ridiculous. Also it's not removing the last character, but deleting all 'n's. Could have achieved the same with the built-in str.replace() method. str.rstrip() isn't used correctly. It won't remove the last character, but will also shorten 'helloooooo' to 'hell'. The loop also removes all 'n's, not necessarily the last character. Plus it is highly inefficient and not pythonic in any way More on reddit.com
๐ŸŒ r/programming
3
0
July 19, 2021
arrays - Removing last character from each element in Python list - Stack Overflow
I have a list find_words which is [u'Duration$', u'Noun$', u'Adjective$'] I would like to remove all the '$' so it looks like [u'Duration', u'Noun', u'Adjective'] How do I go about this? Also, h... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Remove last 3 characters of each element of a list of strings.
s = ['2016-02-27 04:49:29.766684-06โ€™, '2016-02-27 04:49:29.766684-02', ...] s = [timestamp[:-3] for timestamp in s] r/learnpython for more resources :D More on reddit.com
๐ŸŒ r/Python
4
0
June 17, 2016
๐ŸŒ
EyeHunts
tutorial.eyehunts.com โ€บ home โ€บ remove last character from list python | example code
Remove last character from list Python | Example code - EyeHunts
August 16, 2021 - The slice notation [:-1] is the right approach to remove the last character from the list python. You can also use the pop() and del function
๐ŸŒ
Reddit
reddit.com โ€บ r/programming โ€บ 5 ways you can remove last character from string in python
r/programming on Reddit: 5 Ways You Can Remove Last Character From String in Python
July 19, 2021 - Remove last 3 characters of each element of a list of strings. ... Python: How can I replace one specific character on a string while leaving the rest of the string as it was?
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ remove-last-element-from-list-in-python
Remove Last Element from List in Python - GeeksforGeeks
July 12, 2025 - Explanation: a.pop() removes 'Geeks' from the list a. del operator allows removal of list elements by index. To delete the last element, del list[-1] is used, which directly modifies the original list by removing its last item without returning it.
๐ŸŒ
Career Karma
careerkarma.com โ€บ blog โ€บ python โ€บ python: remove last character from string
Python: Remove Last Character from String | Career Karma
December 1, 2023 - The [:-1] is a string slice operation that removes the last character from the list. We use negative indexing to retrieve items from the end of the string.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-program-to-remove-last-character-from-the-string
Python program to Remove Last character from the string - GeeksforGeeks
July 11, 2025 - Str[-1] gets last character of string, which is 's'. Str.rstrip(Str[-1]) removes all trailing 's' characters from the end of the string, not just one. List comprehension with join() creates a list of all characters except the last one, then joins them into a single string.
Find elsewhere
๐ŸŒ
Python Guides
pythonguides.com โ€บ remove-the-last-character-from-a-string-in-python
Remove Last Character from String in Python
August 20, 2025 - Original list: ['New York,', 'Los Angeles.', 'Chicago!', 'Houston/', 'Phoenix?'] Cleaned list: ['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix'] This is a real-world case where removing the last character makes the dataset clean and ready for analysis. Empty Strings: If the string is empty, slicing or regex will still work, but you should handle it to avoid unexpected results. Performance: For large datasets, slicing is the fastest method. Python Version: If youโ€™re using removesuffix(), make sure youโ€™re on Python 3.9 or later.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ python remove last character from string
Python Remove Last Character From String - Spark By {Examples}
May 21, 2024 - How to remove the last character from a string in Python? String manipulation is indeed one of the most important features of Python, and knowing various
๐ŸŒ
Career Karma
careerkarma.com โ€บ blog โ€บ python โ€บ python remove character from string: a guide
Python Remove Character from String: A Guide | Career Karma
December 1, 2023 - The [:-1] is a string slice operation that removes the last character from the list. We use negative indexing to retrieve items from the end of the string.
๐ŸŒ
Kodeclik
kodeclik.com โ€บ python-remove-last-character-from-string
How to remove the last character from a Python string
September 24, 2024 - In other words, by specifying [0:24] we are essentially traversing the string from index 0 to 23. If we desire to skip the last character, we can simply do:
๐ŸŒ
Linux Hint
linuxhint.com โ€บ remove-last-character-from-string
Linux Hint โ€“ Linux Hint
May 14, 2023 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
๐ŸŒ
Python Pool
pythonpool.com โ€บ home โ€บ tutorials โ€บ remove the last character from a python string safely
5 Ways to Remove the Last Character From String in Python
July 13, 2026 - Slicing removes exactly one final code point. removesuffix() removes a known ending only when it is present. rstrip() removes a set of trailing characters and can remove more than one, so it is not the right tool when you need exactly one character removed. ... The slice text[:-1] means โ€œtake everything up to, but not including, the last position.โ€ The omitted start defaults to the beginning of the string. text = "Python!" without_last = text[:-1] print(without_last) print("x"[:-1]) print(""[:-1])
๐ŸŒ
Medium
medium.com โ€บ @pythonchallengers โ€บ python-challenge-unveiled-3-exceptional-approaches-to-solve-it-55c0de213f60
Python Challenge: Removes first and last characteres | by Python Challengers | Medium
December 6, 2023 - In this case, the first pop() removes the first character (index 0) from the list, and the second pop() removes the last character from the list.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-program-to-remove-the-last-element-from-list
Python program to Remove the last element from list - GeeksforGeeks
August 28, 2023 - Given a list of elements, the task here is to write a Python program that can remove the presence of all a specific digit from every element and then return the resultant list. Examples: Input : test_list = [333, 893, 1948, 34, 2346], K = 3 Output : ['', 89, 1948, 4, 246] Explanation : All occurrenc ... In this article, weรขย€ย™ll explore different ways to remove the last N characters from a string in Python.
๐ŸŒ
Reddit
reddit.com โ€บ r/python โ€บ remove last 3 characters of each element of a list of strings.
r/Python on Reddit: Remove last 3 characters of each element of a list of strings.
June 17, 2016 -

I have a list of strings, call it S, where each element has a format similar to '2016-02-27 04:49:29.766684-06โ€™. I want to remove the last three characters from each element of the list so that it looks similar to '2016-02-27 04:49:29.766684โ€™. In this case the last three characters were '-06' but sometimes they are '-05' or some other number following the dash. This is easy to do in R but I can't figure it out in Python.

๐ŸŒ
Javatpoint
javatpoint.com โ€บ how-to-delete-the-last-element-in-a-list-in-python
How to delete the last element in a list in Python - Javatpoint
How to delete the last element in a list in Python with tutorial, tkinter, button, overview, canvas, frame, environment set-up, first python program, etc.