python TypeError: must be encoded string without NULL bytes, not str

前端 未结 3 1069
温柔的废话
温柔的废话 2021-01-12 04:08

Trying to get familiar with python\'s standard library and doing some mucking around with it on my Windows machine. Using python 2.7 I have the following little script whic

3条回答
  •  無奈伤痛
    2021-01-12 04:36

    "...Photos\Modified\0-PyTest"

    Its taking the \0 as a null character. You have to escape \ using \\, or just put an r before the string to make it raw:

    r'C:\Users\me\Photo Projects\Project Name\Project Photos\Modified\0-PyTest'
    

提交回复
热议问题