Data.trn_ds.fnames returning filenames appended with double //

Hey everyone,

I’m trying to emulate the dog breed challenge on my machine and I’m stuck at string manipulation as I cannot access the images from data.trn_ds.fnames the way it returns

I wonder what generates the “\\” in the code and if there is a workaround to replace it with ‘/’ using Python.

I tried subsetting but couldn’t get the result I need.

Any help would be appreciated.

Thanks,

Hi!
What do you mean by “cannot access”?
In fact, Windows uses backslashes as path separators, but it is quite forgiving and works with both kinds of slashes mixed in the path. However, a backslash is also used to denote special characters, such as newline (\n), so it has to be screened by another backslash. As you display it by just writing fn, and not using print(fn), you see the screened version of the path. In short, this path is ok and should work fine in python without further manipulations.