Python报错DeprecationWarning: invalid escape sequence ‘\T‘

In Python, if you use backslashes in strings, you need to use escape characters (such as \n for newline). The above error occurs when you expect a backslash, but there is no escape character.

To fix this error, you can prepend an "r" to the path string to indicate that it is a "raw" string. For example, modify the code to the following:

dir_writeLog = ffather_path + r"\TestDatas\CFFEX" + "/" + writeFilenameLog

Alternatively, you can use two backslashes to represent one backslash:

dir_writeLog = ffather_path + "\\TestDatas\\CFFEX" + "\\" + writeFilenameLog

This avoids DeprecationWarning errors.

Guess you like

Origin blog.csdn.net/songpeiying/article/details/132588292