Hallo,
I have filenames like abc_def_ghl
i want to select def
what should my code be
if f[5:7] == “def”:
d.y = torch.tensor([0]) ?
Hallo,
I have filenames like abc_def_ghl
i want to select def
what should my code be
if f[5:7] == “def”:
d.y = torch.tensor([0]) ?
I would suggest using Python’s str.split()
(Reference):
filename = "abc_def_ghi"
def = str.split(filename, "_")[1]