Skip to content

Instantly share code, notes, and snippets.

import sys
print('The command line arguments are:')
for i in sys.argv:
print(i)
print('\n\nThe PYTHONPATH is', sys.path, '\n')
def total(a=5, *numbers, **phonebook):
print('a', a)
#遍历元组中的所有项目
for single_item in numbers:
print('single_item', single_item)
#遍历词典中的所有项目
for first_part, second_part in phonebook.items():
print(first_part, second_part)
{ "keys": ["enter"], "command": "insert_space", "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "not_regex_contains", "operand": "^\\}", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "(source.c, source.c++, source.python, source.cs)", "match_all": true },
{ "key": "panel_has_focus", "operator": "not_equal", "operand": true},
{ "key": "auto_complete_visible", "operator": "equal", "operand": false},
]
},
import sublime, sublime_plugin
req_single_op_all = '(([\+\-\*/%=<>\|&\^\?]|(<<)|(>>))(=)|(!=))|((?<=[\w ])((<<)|(>>)|(&&)|(\|\|)|[\+\-\*/%=<>\|&\^\?])(?=[\w ]))'
#这个正则表达式匹配:
#+ - * / % = < > | & ^ ? << >> && || != += -= *= /= %= &= ^= |= <<= >>=
reg_tri_op = '\?[\w ]*:'
#三目运算符?:,需要特殊处理,因为':'号在switc case语句中前后不需要加空格
reg_comma = '(,|;)(?=[\w])'
#','';'运算符,需要特殊处理,因为一般','';'前面不加空格,而后面加空格
char_to_ins = ' '