LoginSignup
0
0

More than 1 year has passed since last update.

はじめに

移植やってます

repr() str() (Python)

>>> import datetime
>>> td = datetime.date.today()
>>> print(str(td))
2021-12-09
>>> print(repr(td))
datetime.date(2021, 12, 9)

内容はよく分かりませんが、Rubyだと次の感じかも。

inspect to_s (Ruby)

> require 'date'
> td = Date.today
> puts td.to_s
2021-12-09
> puts td.inspect
#<Date: 2021-12-09 ((2459558j,0s,0n),+0s,2299161j)>

上記の場合、.to_sは付けても付けなくても同じ結果になります。

メモ

  • Python の repr を学習した
  • 道のりは遠そう
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0