LoginSignup
0
0

More than 1 year has passed since last update.

はじめに

移植やってます。
( from python 3.7 to ruby 2.7 )

split (Python)

s = 'a,b,c,d,e'
print(s.split(',', 1))

# ['a', 'b,c,d,e']

Pythonsplitの引数maxsplit分割する回数を指定します。

独習Python 170p

split (Ruby)

s = 'a,b,c,d,e'
print(s.split(',', 2))

# ["a", "b,c,d,e"]

Rubysplitの引数limit分割後の個数を指定します。
「プロを目指す」と「独習」には載っていない情報でした。

メモ

  • Python の split を学習した
  • 道のりは遠そう
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