基本上,如果我有一行以缩进开头的文本,那么获取该缩进并将其放入Python中的变量的最佳方法是什么?例如,如果该行是:
\t\tthis line has two tabs of indention
Run Code Online (Sandbox Code Playgroud)
然后它将返回'\ t\t'.或者,如果该行是:
this line has four spaces of indention
Run Code Online (Sandbox Code Playgroud)
然后它将返回四个空格.
所以我想你可以说我只需要从第一个非空白字符到结尾的字符串中删除所有内容.思考?