小编the*_*ere的帖子

通用方法调用

我有这段代码来自"Java - 初学者指南 - Schildt",第13章:

package com.chapter.thirteen;

public class GenericMethodDemo {
static <T extends Comparable<T>, V extends T> boolean arraysEqual(T[] x, V[] y){
    if(x.length != y.length) return false;

    for(int i = 0; i < x.length; i++)
        if(!x[i].equals(y[i])) return false;

    return true;
}

public static void main(String args[]){

    Integer [] nums  = { 1, 3, 3, 4, 6 };
    Integer [] nums2 = { 1, 3, 3, 4, 6 };
    Integer [] nums3 = { 1, 3, 3, 4, 6 }; …
Run Code Online (Sandbox Code Playgroud)

java generics

7
推荐指数
1
解决办法
140
查看次数

Python日志记录-多个模块

我正在研究一个具有以下结构的小型python项目-

project 
 -- logs
 -- project
    __init.py__
    classA.py
    classB.py
    utils.py
 -- main.py
Run Code Online (Sandbox Code Playgroud)

我已经设置了日志记录配置__init.py__下的项目如下:

import logging
from logging import StreamHandler
from logging.handlers import RotatingFileHandler

# Create the Logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

# Create the Handler for logging data to a file
logger_handler = RotatingFileHandler('logs\\mylog.log', maxBytes=1024, backupCount=5)
logger_handler.setLevel(logging.INFO)

#Create the Handler for logging data to console.
console_handler = StreamHandler()
console_handler.setLevel(logging.INFO)

# Create a Formatter for formatting the log messages
logger_formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')

# Add the …
Run Code Online (Sandbox Code Playgroud)

python logging config

5
推荐指数
1
解决办法
2368
查看次数

标签 统计

config ×1

generics ×1

java ×1

logging ×1

python ×1