Converting tensor into text then performing replace

Hello everyone, I have the following function:

def get_videoname(paths):

    
    vidname = str(paths)
    vidname = vidname.strip()
    vidname = vidname.replace('[', '')
    vidname = vidname.replace(']', '')
    vidname = vidname.replace(' ', '')
    vidname = vidname.replace(r"D:\\A\\C\\frames-KP\\dev\\", '')
 
    vidname = vidname.split(',')
    return vidname

and it outputs the following after I loop through the list:

'K000000_P0000_T00\\000024.jpg.npy'
'K000000_P0000_T00\\000025.jpg.npy'
'K000000_P0000_T00\\000026.jpg.npy'
'K000000_P0000_T00\\000027.jpg.npy'
'K000000_P0000_T00\\000028.jpg.npy'
'K000000_P0000_T00\\000029.jpg.npy'
'K000000_P0000_T00\\000030.jpg.npy'
'K000000_P0000_T00\\000031.jpg.npy'

How can I edit my function so I can remove *.jpg.npy

I tried re.sub(r'\(*.jpg.npy\)', '', vidname), but it doesn’t seem to work.

Wouldn’t another replace call work?
Also, how is this related to tensors?