How do I untab line (-1 tab)?

时间:2019-01-07 13:04:21

标签: python tabs

I am looking for a sign that can untab a line:

  • \t - tabs a line
  • \n - new line

How do I untab a line (-1 tab)? Is there a way to do it?

1 个答案:

答案 0 :(得分:0)

没有这样的特殊字符来“取消”一行。如果要修改字符串并仅删除一个标签,可以使用str.replace

mystring = mystring.replace('\t', '', 1)