作者OnoderaHaru (小野寺春)
看板Python
標題Re: [問題] 迴圈問題
時間Wed Feb 23 23:15:17 2022
第三方模組我比較喜歡用 arrow
import arrow
start = arrow.get('2018-06')
end = arrow.get('2019-12')
for date in arrow.Arrow.range('month', start, end):
print(date.format('YYYY/M'))
--
小野寺春が大好きだよ~
https://i.imgur.com/p7jq5X0.gif
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.139.194.239 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Python/M.1645629321.A.2A4.html
1F:推 skyleona: 感謝O大解答 02/24 00:21