I feel like I have a very straightforward piece of code. I have a file name that follows the form of 'stuff_category.csv'. I'm trying to remove 'stuff_' and '.csv', so that I will be left with 'category', which I need for the next piece of code. 'stuff_' can be many different things, so I can't use the replace() function. Right now I have
filename = "stuff_category.csv"
category = filename.lstrip('_').rstrip('.')
But if I try print(category), or even print(category.lstrip('_')), it just returns the original file name. What am I missing?