Programming languages, such as Python, treat a backslash (\) as an escape character. For instance, \n represents a line feed, and \t represents a tab. When specifying a path, a forward slash (/) can be used in place of a backslash. Two backslashes can be used instead of one to avoid a syntax error. A string literal can also be used by placing the letter r before a string containing a backslash so it is interpreted correctly.
Example 1: Valid use of paths in Python
import arcpy arcpy.GetCount_management("c:/temp/streams.shp") arcpy.GetCount_management("c:\\temp\\streams.shp") arcpy.GetCount_management(r"c:\temp\streams.shp")
In the following sample, backslashes are used by mistake, and \t is interpreted as a tab by Python. Get Count will fail, as the path is interpreted differently than it was intended.
Example 2: Invalid use of paths in Python
import arcpy arcpy.GetCount_management("c:\temp\streams.shp") # ExecuteError: Failed to execute. Parameters are not valid. # ERROR 000732: Input Rows: Dataset c: em\streams.shp does not exist or is not supported # Failed to execute (GetCount)