Use r to define a string and return its length
path = r'C:\new\text.dat' print path print len(path) # string length