Programmingfreak
Programmingfreak

Reputation: 61

Open(Filename, mode) Python

Where to get the File name from?

file= open("C:\Users\Dell\Desktop\ll\file3.txt", "r")

python shows me that there is a syntax error,is it the file name?

Upvotes: 1

Views: 256

Answers (1)

Cory Kramer
Cory Kramer

Reputation: 117856

You need to use a raw string literal

r"C:\Users\Dell\Desktop\ll\file3.txt"

or escape your backslashes

"C:\\Users\\Dell\\Desktop\\ll\\file3.txt"

Upvotes: 3

Related Questions