INNER CODE UNIT · Python

printerr

fyoorer/ShadowClone · shadowclone.py:19

def printerr(msg):
    sys.stderr.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S,%f")[:-3] +" " + msg + "\n")


def is_file_small_enough(file_path):
    return os.path.getsize(file_path) < 5 * 1024 * 1024


def splitfile(infile, SPLIT_NUM):
    # from https://stackoverflow.com/questions/16289859/splitting-large-text-file-into-smaller-text-files-by-line-numbers-using-python
    lines_per_file = int(SPLIT_NUM)

    smallfile = None
    chunks = []
    with open(infile, 'r', encoding='utf8', errors='ignore') as bigfile:
        tempdir = tempfile.gettempdir()
        for lineno, line in enumerate(bigfile):
            if lineno % lines_per_file == 0:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…