Answer
Here single backslashes(\) are usen in the path string, in python \ is special character used in string formatting so we can not use them directly in a string, to use a backslash we need to put two backslash together like \\. So we can correct the given code by writing
infile = open("c:\\book\\test.txt", "r")
Work Step by Step
Same as above.