Redis SAVE 命令用于创建当前数据库的备份。
redis Save 命令基本语法如下:
redis 127.0.0.1:6379> SAVE
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) |
from multiprocessing.managers import SyncManager | |
class PointClass: | |
def __init__(self, value): | |
self.value = value | |
class MathsClass: | |
def __init__(self, point_one, point_two): |
# 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") |
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) |
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)); |
// 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")); |
List<?> list = new ArrayList<>( myQueue );
? can be be the class you want to transfer
public static strictfp String humanReadableByteCount(long bytes, boolean si) { | |
int unit = si ? 1000 : 1024; | |
long absBytes = bytes == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(bytes); | |
if (absBytes < unit) return bytes + " B"; | |
int exp = (int) (Math.log(absBytes) / Math.log(unit)); | |
long th = (long) (Math.pow(unit, exp) * (unit - 0.05)); | |
if (exp < 6 && absBytes >= th - ((th & 0xfff) == 0xd00 ? 52 : 0)) exp++; | |
String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i"); | |
if (exp > 4) { | |
bytes /= unit; |
public class Test { | |
public static void main(String[] args) { | |
List<String> list1 = new ArrayList<String>(); | |
list1.add("1"); | |
list1.add("2"); | |
list1.add("3"); | |
list1.add("5"); | |
list1.add("6"); | |