python pain.

why do i get a syntax error in the following?

# traverse the dir, remove temp files
for dpath, dirList, fileList in os.walk(inPath, topdown=False):
    for ff in fileList:
        if (ff == ".htaccess") or \
                (ff == ".DS_Store") or \
                re.search(r"^xx", ff) or \
                re.search(r"^#.+#$", ff) or \
                # re.search(r"~$", ff) or \
                re.search(r"^xx", ff):
            print("◆", ff)

File "/home/xah/git/xahscripts/make_download_copy/delete_temp_files.py3", line 46
    # re.search(r"~$", ff) or \
                              ^
SyntaxError: invalid syntax

if you remove the comment, then it's fine.

seems like a syntax BUG!
Shared publiclyView activity