Redis SAVE 命令用于创建当前数据库的备份。
redis Save 命令基本语法如下:
redis 127.0.0.1:6379> SAVE
// traditional method | |
ArrayList<String> list = new ArrayList<String>(); | |
list.add("A"); | |
list.add("B"); | |
list.add("C"); | |
// one-line method | |
ArrayList<String> list = new ArrayList<>(Arrays.asList("A","B","C")); |
public class App | |
{ | |
public static void main( String[] args ) | |
{ | |
TestService testService = new TestServiceImpl(); | |
String name = "testName"; | |
EnumMap<TestService.UserInfoProperty,Object> userInfo = testService.getUserInfoByName(name); | |
userInfo.entrySet().iterator(); | |
System.out.println(userInfo.get(TestService.UserInfoProperty.Name)); | |
System.out.println(userInfo.get(TestService.UserInfoProperty.ROOM)); |
try: | |
# logs folder initialization | |
self.logs_path = Path("./logs") | |
self.logs_path.mkdir(exist_ok=True) | |
# repos folder initialization | |
self.repos_path = Path("./repos") | |
self.repos_path.mkdir(exist_ok=True) | |
# issues folder initialization | |
self.issues_path = Path("./issues") | |
self.issues_path.mkdir(exist_ok=True) |
# setup the logging information | |
import datetime | |
today = datetime.today() | |
logging.basicConfig(format="%(asctime)s %(levelname)s %(name)s %(message)s", | |
datefmt="%d-%M-%Y %H:%M:%S", level=logging.DEBUG, handlers=[ | |
logging.FileHandler(filename=f"{today}.log"), | |
logging.StreamHandler() | |
]) | |
logger = logging.getLogger() | |
logger.info("Test") |
from multiprocessing.managers import SyncManager | |
class PointClass: | |
def __init__(self, value): | |
self.value = value | |
class MathsClass: | |
def __init__(self, point_one, point_two): |
from decimal import Decimal, ROUND_HALF_UP | |
origin_num = Decimal('11.245') | |
answer_num = origin_num.quantize(Decimal('0.00'), rounding=ROUND_HALF_UP) | |
print(answer_num) |
def increasing(A:List[int])->bool: | |
return all(x<=y for x,y in zip(A,A[1::])) | |
def decreasing(A:List[int])->bool: | |
return all(x>=y for x,y in zip(A,A[1::])) | |
#如果要检查是否是连续上升或下降,就用 or 把两个连起来 | |
def isMonotonic(A: List[int]) -> bool: | |
return self.increasing(A) or self.decreasing(A) |
test = [True,True,False,False] | |
print(sum(test)) # 2 |
from itertools import chain # 这里要用itertool里的chain | |
# 因为在python2里 range() 返回list | |
# python3 里range 返回iterator,不能直接相加,要用chain方法 | |
for i in chain(range(n), range(n)[::-1]): # 这个写法可以实现一个for里双向遍历 |