Y
Yunfei Dai
Hi all,
I have some questions on "import":
1."from datetime import datetime" works well. But I am confused why "importdatetime.datetime" leads to importerror. "from xlrd import open_workbook" could be replaced by "from xlrd.open_workbook" without any problem. The only difference here is that if "from xlrd import open_workbook" is used we donot have to write "xlrd.open_workbook" in the following code but just "open_workbook". So my understanding of the difference is "from...import..." shortens the code (just like "using namespace std" in C++) but maybe leads toname clash. But what is the problem of datetime?
2.I am also comfused that "datetime.datetime" is a function but whithin "datetime.datetime" there are lots of other functions. So what is the type of "datetime.datetime" on earth? is it a function, or a class or a folder(library) here?
Thanks very much in advance! Very looking forward to your answers.
Best,
Yunfei
I have some questions on "import":
1."from datetime import datetime" works well. But I am confused why "importdatetime.datetime" leads to importerror. "from xlrd import open_workbook" could be replaced by "from xlrd.open_workbook" without any problem. The only difference here is that if "from xlrd import open_workbook" is used we donot have to write "xlrd.open_workbook" in the following code but just "open_workbook". So my understanding of the difference is "from...import..." shortens the code (just like "using namespace std" in C++) but maybe leads toname clash. But what is the problem of datetime?
2.I am also comfused that "datetime.datetime" is a function but whithin "datetime.datetime" there are lots of other functions. So what is the type of "datetime.datetime" on earth? is it a function, or a class or a folder(library) here?
Thanks very much in advance! Very looking forward to your answers.
Best,
Yunfei