AnsweredAssumed Answered

Search for a string with \ in the search

Question asked by rastrauch Champion on May 26, 2015
Latest reply on May 26, 2015 by rastrauch

This is part of a larger python script that is helping classify layers with broken links.  It's pretty close to being done, but I decided to break down my large Layer "other" group.  No need to get caught up in details (or simplifying syntax) right now, but I need help with the "\arc" and "\region" lines (18 and 21) below.  I'm assuming that \a and \r are special characters and therefore not seeing this as a string?  I did a search but didn't find a good resource even though I'm sure one exists.    I know \n is an issue - new line, but not sure if that is my problem here or not.

 

1 - where would I find a good list of special character for python; and

2 - how would I do a search for the "\arc" and "\region" strings?

 

if ".shp" in lyr.dataSource:  # shapes

    elif ".gdb" in lyr.dataSource:  # file gdb
        lyrType = "Fgdb"                            

    elif ".mdb" in lyr.dataSource:  # personal gdb or access file
        lyrType = "Pgdb"                            

    elif ".dbf" in lyr.dataSource:  # dbase format
        lyrType = "Dbf"                            

    elif ".txt" in lyr.dataSource:  # text file
        lyrType = "Txt"                            

    elif "\polygon" in lyr.dataSource:  # coverage polygon features
        lyrType = "Cover_poly"                            

    elif "\arc" in lyr.dataSource:  # coverage arc features
        lyrType = "Cover_arc"                            

    elif "\region" in lyr.dataSource:  # coverage region features
        lyrType = "Cover_region"                            

    elif "\point" in lyr.dataSource:  # coverage point features
        lyrType = "Cover_pts"                            

    elif ".sdc" in lyr.dataSource:  # shapes
        lyrType = "Esri.sdc"

    else: # pretty much evrything else includeing fgdb
        lyrType = "other"

 

Thanks!

Outcomes