def col (loc,strg):
    s = strg
    return 1 if loc<len(s) and s[loc] == '\n' else loc - s.rfind("\n", 0, loc)
Returns current column within a string, counting newlines as line separators.
dataset/ETHPy150Open pypa/pip/pip/_vendor/pyparsing.py/col