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 logging | |
def createLogger(name): | |
logger = logging.getLogger(name) | |
hdlr = logging.FileHandler('test.log') | |
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
hdlr.setFormatter(formatter) | |
logger.addHandler(hdlr) | |
logger.setLevel(logging.DEBUG) | |
return logger |
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 logging | |
logging.basicConfig(filename='example.log',level=logging.DEBUG) | |
logging.debug('This message should go to the log file') | |
logging.info('So should this') | |
logging.warning('And this, too') |
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 logging | |
def createLogger(name): | |
logger = logging.getLogger(name) | |
hdlr = logging.FileHandler('test.log') | |
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
hdlr.setFormatter(formatter) | |
logger.addHandler(hdlr) | |
logger.setLevel(logging.DEBUG) | |
return logger |
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 logging | |
import logging.config | |
import json | |
with open('logger.json') as json_data_file: | |
data = json.load(json_data_file) | |
logging.config.dictConfig(data) | |
class A(): | |
def __init__(self): |
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
{ | |
"version": 1, | |
"formatters": { | |
"default": { | |
"format": "default %(asctime)s %(levelname)s %(message)s" | |
}, | |
"forA": { | |
"format": "forA %(asctime)s %(levelname)s %(message)s" | |
}, |
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
class SquareFreeString: | |
def get_all_substrings(self, input_string): | |
length = len(input_string) | |
return [input_string[i:j + 1] for i in range(length) for j in range(i, length)] | |
def isSquareFree(self, test): | |
t = self.get_all_substrings(test) | |
for i in t: | |
if len(i) % 2 != 0: |
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
class SquareFreeString: | |
def get_all_substrings(self, input_string): | |
length = len(input_string) | |
return [input_string[i:j + 1] for i in range(length) for j in range(i, length)] | |
def isSquareFree(self, test): | |
t = self.get_all_substrings(test) | |
for i in t: | |
if len(i) % 2 != 0: |
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
class SortingSubsets: | |
def getMinimalSize(self, a): | |
b = sorted(a) | |
ans = 0 | |
for x in range(len(a)): | |
if a[x] != b[x]: | |
ans += 1 | |
return ans |
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
#include<iostream> | |
#include<cstring> | |
using namespace std; | |
class ThueMorseGame | |
{ | |
public: | |
string get(int n, int m) | |
{ |
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 count(a): | |
return len(bin(a)[2:].replace("0", "")) | |
class ThueMorseGame: | |
def get(self, n, m): | |
last = 0 | |
i = 0 | |
while i <= n: | |
if count(i)%2 == 1: | |
i += 1 | |
else: |
OlderNewer