Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb65552

Browse files
gh-106318: Add examples for str.join() (#140315)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent0cde70b commitfb65552

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎Doc/library/stdtypes.rst‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,16 @@ expression support in the :mod:`re` module).
22282228
Return a string which is the concatenation of the strings in *iterable*.
22292229
A:exc:`TypeError` will be raised if there are any non-string values in
22302230
*iterable*, including:class:`bytes` objects. The separator between
2231-
elements is the string providing this method.
2231+
elements is the string providing this method. For example:
2232+
2233+
..doctest::
2234+
2235+
>>>','.join(['spam','spam','spam'])
2236+
'spam, spam, spam'
2237+
>>>'-'.join('Python')
2238+
'P-y-t-h-o-n'
2239+
2240+
See also:meth:`split`.
22322241

22332242

22342243
..method::str.ljust(width, fillchar=' ', /)
@@ -2442,6 +2451,8 @@ expression support in the :mod:`re` module).
24422451
>>> " foo ".split(maxsplit=0)
24432452
['foo ']
24442453

2454+
See also:meth:`join`.
2455+
24452456

24462457
..index::
24472458
single: universal newlines; str.splitlines method

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp