Nov-25-2018, 02:41 AM
(This post was last modified: Nov-25-2018, 03:18 AM by ichabod801.)
Hi All,
I want to know what is the difference between variables " today," and "today" in the below example. First option is giving output in date format, while second one is not . Just by adding "," after the variable name, its printing correct format. both are holding tuple data.
I want to know what is the difference between variables " today," and "today" in the below example. First option is giving output in date format, while second one is not . Just by adding "," after the variable name, its printing correct format. both are holding tuple data.
>>> cursor.execute("select sysdate from dual")
<cx_Oracle.Cursor on <cx_Oracle.Connection to hr@localhost:1521>>
>>> today, = cursor.fetchone()
>>> print("The current date is", today)
The current date is 2018-11-25 03:36:57
>>> cursor.execute("select sysdate from dual")
<cx_Oracle.Cursor on <cx_Oracle.Connection to hr@localhost:1521>>
>>> today= cursor.fetchone()
>>> print("The current date is", today)
The current date is (datetime.datetime(2018, 11, 25, 3, 37, 52),)
>>> type (today)
<class 'tuple'>
>>> type (today,)
<class 'tuple'>
