This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def run(chat_input): | |
# 干掉段落前后的空格并分行 | |
lines = chat_input.strip().split("\n") | |
lines_len = int(lines[0]) if lines[0].isdigit() else 0 | |
result = "" | |
for line in lines[1 : min(lines_len + 1, len(lines))]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!T35wVTnY1d8VllqbCaAC4vDzr3cizlfRwBPut5C7bztjrlZAjsbskFjpyK9cAYEn7MwGf)Z2(Wcu02fTy3Uaf)XEjT7xM1oop1Vc9mZqsnKCifLLSLS3aKl2uudNlNZz(DoZzg2GVr9gk2nuewKNBrE(gk9AO0g9h4YnvBTBBlZ(lz210cUqvE8FeW)Ri(FLAuLBr5goWnBA1wZQO7xPHsXU6p4bQwTpAR6MMDD0HlPoWzhtRA9D0nnSHYZ)BvXWwZbkpEVl0OP3pvQDhTgkvnnG)1sRd8nRFyF4N7yzoOV3nPO)an4RNX73tvf(WABVn6Xw(6z5eZKld8xorPC8zeAS91LGYs7G(QgT1AJQmow6D6Ozztk06(xa9JT1Aoy7TjvRvkT6TkVXQWNJ)v1bwQcq)BFTUDR02TnBpOP2EAgokW3s)GgkBUubL6BQuVW6qHnWqhUL(DvpekC)B9wwA4Bv5wLwfkC81GhMMAxNDAOyO2tJu2oOcyyvZHCj7wQDr9pnu0nC0Smu7EBOPaDLW14AOCGBhrv4Nvn07PIgFWIfoQwo4wi0mqxCtsRYwRLPb0ACBKgObh4X0tv3i93926g627K67h(g6GCzxluDSfigDltDuFWsLQwV06qXzbDcWOIQJkULsUPYORsgzuwA9sLQc9pOI5U38WknVJ21(1Ri1qbECBR3HwE0RdrgvB6UT7JQyT61RT2QLkxh)DARtjh31ufRYmWwBZwDvTrvFRbA4H(wOpO3aqhWBmIChOEyDJoDrInBqAfbUlBKuDOVkCz1wEpx)bi6UtuhfsgY)(BnuMv7ahHq9BORXx2eKg91HALO2dpTUt1RlZfZaslqRVT5(gk7RdD)fHlmW2XSxD45Tr)2QoqREG3)B1THYooo9TF9BCJ9v7yUOU5nQYFV(hUzU7DNBKfgJ0HoCuHa9VD6AUprbVPBtcv9BOu2s)bhT1VzGABKqay2bAX7QP1VaAiWzDKig6BqnGgUQIQBLmuB2f05l621e(3xcEwGCEp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A1DmPgAliaCaRcUtUtiFUvVLKULDVOkYkGWSeAZS0xTVNVK0jZT6phTGSaRzEtE6idA7pQgGSgThoKqqhZJ6KEVNBEoXpbRRkj6ilJFK6SSIlRJBMlNVuYmSnSh+AoYqcVQiSC0FyVNkKuSqRG1VVYmvEoGxqirJWaWIWKsUUW9VVdxVitor/kqRwUDhsMpiKj1WZLKqXKZsBvVZQqNJdZqq1aoq9RqlMluq2xLsJvmNargqjitFWg71XGE6cV2ptivpO1CNV5TzUlhPSvYDRdsmgmjPqkqqy0sR6fSqSsqdiaC4NBGUDigo9J2ce3gEhQ6Lh2+SoJBuvqhLGJDmGxKbCXktC1MyBO4/0cOURkI2ewx7U5MFhcRmUuW4cBJqLkMtLVRzCNx/ooeZgzRDMFcSamcPtjHArxHS/WcQ9RfT/dQtdUg3X9QljHaIY29KTjxXoS0ABdlkgEH/v5DuP4OoZl5wT1KHxGZCXsvCgN6Q2Ew2CYfhYRIG9EZCOlccB4V080VdwoA0KyGxmZDXsjAlQ+D+Ez1MaSSE7dnlxHMVFDJ1brfUId18UZcwIM03JDYT8loWpmQI3H+ihymNhE7LsBcLCunmi7qEAWm+IbGZkNeyMCVD4P4TPUxpJBKadoxNCdqFY389TCU0ugWF1BXs6Sc2gkJyuGgy8V1JUMjUud1SR0KiYzsJCpk6t1vqSCT0nZzYTEZQ6DllHTooZOrcbl/qkOBT4zlsSlKHwP0nehjQ+0ZCzynrG0EhU+d2+1KHBJ8az2FTkjoE7j/Rw4DeNxJ6TlkvDQqZOrfblzok+NR4DpuS1KHrj35hXvalIXD/iR4GumTJSOg5ZV0zKATuP9HDgN43EgkVvPKFe4JChXv8xNUICvmJqwLfh/HVcOpIyN1FuBpBoVOTznHoLy0UgjT//0IFvg/jq+HUkUgk5F5xBIW8WOFnq/UqVxJqZw+2McCvEfJihZ+t1pv3IbzQzDvHrTq3W+qQe8US+E/0MHNQJTTxXUmVKwm1swfb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import sys | |
def reraise_as(new_exception_or_type): | |
""" | |
Obtained from https://github.com/dcramer/reraise/blob/master/src/reraise.py | |
>>> try: | |
>>> do_something_crazy() | |
>>> except Exception: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
map = { | |
'name1': ('package.module1', 'Class1'), | |
'name2': ('module2', 'Class2'), | |
} | |
def get_class(name): | |
class_path_tuple = exchange_api_map[name.lower()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for name in names %} | |
<img src="images/{{name}}.png" /> | |
<a href="toggle/?name={{name}}&action=on">开</a><a href="toggle/?name={{name}}&action=off">关</a>' | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from functools import wraps | |
def retry(retry_time=10): | |
def retry_decorator(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
while True: | |
result = func(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check(pin): | |
mark = '10X98765432' | |
code = sum([int(val) * 2 ^ index for index, val in enumerate(list(pin)[:17])]) % 11 | |
return pin[18] == mark[code] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import re | |
import requests | |
res=requests.get('http://bbs.nga.cn/read.php?tid=6406100&lite=js') | |
print(json.loads(re.search(r'\{.*\}', res.content.decode('GBK'))[0], strict=False)) |