私のコード:。スプリットスプリットを使用して、選択したスペースに文字列(「」、INT)
firstname = 'Christopher Arthur Hansen Brooks'.split(' ',1) # [0] selects the first element of the list
lastname = 'Christopher Arthur Hansen Brooks'.split(' ')[-1] # [-1] selects the last element of the list
print(firstname)
print(lastname)
私はの出力たい:私だけ使って、その出力をしたい
['Christopher Arthur Hansen', 'Brooks']
をsplit(' ', int)
方法。どうしたらいいですか?
右から分割したいですか? ['rsplit'](https://docs.python.org/3/library/stdtypes.html#str.rsplit)を考えましたか? – jonrsharpe
あなたはカンマが欲しいと思います。 '' '' '' Christopher Arthur Hansen '、' Brooks '' – pylang