Skip to content

Commit 8f54997

Browse files
committed
add str.expandtabs
1 parent 35883a3 commit 8f54997

File tree

1 file changed

+13
-0
lines changed
  • graalpython/lib-graalpython

1 file changed

+13
-0
lines changed

graalpython/lib-graalpython/str.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ def partition(self, sep):
3535
str.partition = partition
3636

3737

38+
def expandtabs(self, tabsize=8):
39+
"""
40+
S.expandtabs(tabsize=8) -> str
41+
42+
Return a copy of S where all tab characters are expanded using spaces.
43+
If tabsize is not given, a tab size of 8 characters is assumed.
44+
"""
45+
return self.replace("\t", " " * tabsize)
46+
47+
48+
str.expandtabs = expandtabs
49+
50+
3851
# Auto number state
3952
ANS_INIT = 1
4053
ANS_AUTO = 2

0 commit comments

Comments
 (0)