It is because you don't use a raw string. The double backslash is interpreted as an escape for the closing square bracket. You need to write:
fileName = re.match(r"[^\\]*.c$", fileName)
with the raw string format \\
is seen as a literal backslash as expected.