utils.py

来自「Python Development Environment (Python I」· Python 代码 · 共 25 行

PY
25
字号
import re

def getLineSeperator(line):
    if line.endswith("\r\n"):
        linesep = "\r\n"          # windoze
    else:
        linesep = line[-1]   # mac or unix
    return linesep


def getTabWidthOfLine(line):
    match = re.match("\s+",line)
    if match is None:
        return 0
    else:
        return match.end(0)

def reverseCoordsIfWrongWayRound(startcoords,endcoords):
    if(startcoords.line > endcoords.line) or \
         (startcoords.line == endcoords.line and \
          startcoords.column > endcoords.column):
        return endcoords,startcoords
    else:
        return startcoords,endcoords

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?