#20550: python的可愛模組


allenphant11@gmail.com (王睿君)


import datetime
 
d1=datetime.datetime(年,月,日)
d2=datetime.datetime(年,月,日)
abs((d1-d2).days)就是天數差
#20706: Re:python的可愛模組


TCFSH69 (TCFSH)


import datetime
 
d1=datetime.datetime(年,月,日)
d2=datetime.datetime(年,月,日)
abs((d1-d2).days)就是天數差


補充:若要只擷取數字部分的話

可以使用(d2-d1).days

#20707: Re:python的可愛模組


TCFSH69 (TCFSH)


import datetime
 
d1=datetime.datetime(年,月,日)
d2=datetime.datetime(年,月,日)
abs((d1-d2).days)就是天數差


補充:若要只擷取數字部分的話

可以使用(d2-d1).days


抱歉演殘沒看到樓主已使用

#21415: Re:python的可愛模組


10811124@stu.cmsh.khc.edu.tw (立峰陳)


請問

import datetime
a=input()
b=a.split(' ')
c=input()
d=c.split(' ')
while a:
  try:
    d1=datetime.datetime(int(b[0]),int(b[1]),int(b[2]))
    d2=datetime.datetime(int(d[0]),int(d[1]),int(d[2]))
    print(abs((d1-d2).days))
    a=input()
    b=input()
  except:
    break
 
 
 
錯在哪裡?
 
#21422: Re:python的可愛模組


753951852456 (精神小伙不請自來)


請問

import datetime
a=input()
b=a.split(' ')
c=input()
d=c.split(' ')
while a:
  try:
    d1=datetime.datetime(int(b[0]),int(b[1]),int(b[2]))
    d2=datetime.datetime(int(d[0]),int(d[1]),int(d[2]))
    print(abs((d1-d2).days))
    a=input()
    b=input()
  except:
    break
 
 
 
要加
[eocmparvgaksoag[ip[KANQ0C9TEVUW90
W00-IM-0In9wuvncw-m0ei-0icw
b-00ke-0ti0c0g9eugw-0ithds
topd90mew9copkod;gimevi-ub
05cxi3j8eute09gur90hrvwe0h9093hrwg890
orwjgrnvt0u9wjm09c09ug9e
e0vy-0vwk9y0uiybrhhttutktdg
不知道可不可以ac?
#21435: Re:python的可愛模組


fdhs109_GT (GT coding)


753951852456 (哈哈哈!)

 

對於不斷的在討論區搗蛋,

很好奇你的想法。

#25090: Re:python的可愛模組


hsugoya@gmail.com (Мигает cf4?)


 

753951852456 (精神小伙不請自來)


幼稚,非常幼稚