Python Forum
difference between today, and today variables
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
difference between today, and today variables
#1
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.

>>> 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'>
Reply


Messages In This Thread
difference between today, and today variables - by nmrt - Nov-25-2018, 02:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  i tried to install python for the first time today and pretty certain im being remote brianlj 2 734 Oct-03-2023, 11:15 AM
Last Post: snippsat
  Need to identify only files created today. tester_V 5 4,931 Feb-18-2021, 06:32 AM
Last Post: tester_V
  Make list of dates between today back to n days Mekala 3 2,530 Oct-03-2020, 01:01 PM
Last Post: ibreeden
  Store Previous date to calculate delta from today Captain_Wolf 7 3,530 May-08-2020, 06:08 PM
Last Post: SheeppOSU
  Substracting today's date from a date in column of dates to get an integer value firebird 1 2,229 Jul-04-2019, 06:54 PM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020