简体   繁体   中英

open a excel file in python

错误

I am using Windows and python 3.6.1

import xlrd

workbook = xlrd.open_workbook("C:\\Users*******\\Desktop\\excela.xlsx") sheet = workbook.sheet_by_index(0)

What is the error in the code?

Backslash () is an escape code inside a double quoted string. Options: - Change to "\\" so it produces a single unescaped backslash. - Change to single quotes. - Use forward slash (/) and let Python file handling translate to Windows conventions.

See this answer: Windows path in python

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM