Skip to content

Instantly share code, notes, and snippets.

@lihuanshuai
Last active July 12, 2019 03:14
Show Gist options
  • Save lihuanshuai/755e10a2e7e22fce64781903933b3ffb to your computer and use it in GitHub Desktop.
Save lihuanshuai/755e10a2e7e22fce64781903933b3ffb to your computer and use it in GitHub Desktop.
script for fixing python problem
import re
regex = re.compile(r'\\(\d+)'
def repl(m):
return r'\x' + hex(int(m.group(1), 8)).replace('0x', r'').zfill(2)
lines = vscode.editor.lines
lines = [line.decode() for line in lines]
lines = [regex.sub(repl, line) for line in lines]
text = '\n'.join(lines)
vscode.editor.text = text.encode()
pylint $file | grep "undefined-variable" | sed "s/.* Undefined variable \'\([_A-Za-z0-9]\{1,\}\)\'.*/\1,/" | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment