Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Escape chars - how to extract just file name?

$
0
0
I have an attribute that contains the entire path of some photos and I would like to extract just the file name with extension.

Example:
Input: \\ITDNAS\MapLibrary\Photos\RRpics\058721Nn.jpg
Output: 058721Nn.jpg

Attempting to use the following in the field calculator, but I'm getting hung up on the escape chars (\) in the path.
Code:

!PicForward!.split('\')[2]
Could someone point out the correct way to go about this, please.

Viewing all articles
Browse latest Browse all 2485

Trending Articles