win32com.client <unknown>.Cells
Chris Angelico
rosuav at gmail.com
Mon Oct 12 10:50:18 EDT 2015
On Tue, Oct 13, 2015 at 1:37 AM, Michiel Overtoom <motoom at xs4all.nl> wrote:
> Hi,
>
>> excel_book=Excel.Workbooks.Open('D:\WebPython\Config3.xlsx')
>
> Shouldn't this be:
>
> excel_book=Excel.Workbooks.Open('D:\\WebPython\\Config3.xlsx')
> or
> excel_book=Excel.Workbooks.Open(r'D:\WebPython\Config3.xlsx')
> ?
Ideally yes, but in this case it's the same. \W is an unrecognized
escape sequence, so it represents REVERSE SOLIDUS followed by LATIN
CAPITAL LETTER W. (IMO this is a misfeature in Python. I'd prefer
unrecognized escapes to trigger SyntaxError, so people don't get
confused when they change to "C:\Users\fred" and it changes in
meaning.)
ChrisA
More information about the Python-list
mailing list