在 Python 中执行此操作的最短方法是什么?
string = " xyz"
必须返回 index = 3
最佳答案
>>> s = " xyz"
>>> len(s) - len(s.lstrip())
3
关于python - 返回 Python 字符串中第一个非空白字符的最低索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2378962/
在 Python 中执行此操作的最短方法是什么?
string = " xyz"
必须返回 index = 3
最佳答案
>>> s = " xyz"
>>> len(s) - len(s.lstrip())
3
关于python - 返回 Python 字符串中第一个非空白字符的最低索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2378962/