#author("2019-10-15T11:01:36+09:00","default:Authors","Authors")
#author("2019-10-17T16:24:40+09:00","default:Authors","Authors")
* 書式保持メモ [#sda4f9c8]

*** https://qiita.com/okoppe8/items/b56499fc04e6c2193b9d [#z200e3e6]

 LOGGING = {
     'version': 1,
     'disable_existing_loggers': False,
     'formatters': {
         'production': {
             'format': '%(asctime)s [%(levelname)s] %(process)d %(thread)d '
                       '%(pathname)s:%(lineno)d %(message)s'
         },
     },
     'handlers': {
         'file': {
             'class': 'logging.handlers.TimedRotatingFileHandler',
             'filename': '/var/log/django/django.log',
             'formatter': 'production',
 #            'level': 'INFO',
             'when': 'D',
             'interval': 1,
             'backupCount': 14,
         },
     },
     'loggers': {
         '': {
             'handlers': ['file'],
 #            'level': 'INFO',
             'propagate': False,
         },
         'django': {
             'handlers': ['file'],
 #            'level': 'INFO',
             'propagate': False,
         },
     },

 import sys
 import os
 import glob
 import random
 import shutil
 import errno
 
 args = sys.argv
 
 try:
     os.makedirs( "./test" )
     os.makedirs( "./train" )
     os.makedirs( "./valid" )
 except OSError as e:
     if e.errno != errno.EEXIST:
         raise e
 
 fileList = glob.glob( "./*.mid*" )
 
 #print( "hello" )
 #print( args[1] )
 for file in fileList:
     randNum = random.randint(0,11)
     if 0 == randNum:
         shutil.copy( file, "./test" )
     elif 1 == randNum:
         shutil.copy( file, "./valid" )
     else:
         shutil.copy( file, "./train" )
 
 sys.exit()

 #include <stdio.h>
 #include <time.h>
 #include <stdlib.h>
 
 int main( void )
 {
     int rtnCod = 0;
     char strArr[10][9] = { "", };
     int intArr[10] = { 0, };
     int cnt = 0;
     int num = 0;
 
     srand( (unsigned int)time( NULL ) );
 
     for( cnt = 0; 10 > cnt; cnt++ )
     {
         intArr[cnt] = rand();
         printf( "%x\r\n", intArr[cnt] );
         snprintf( strArr[cnt], 9, "%x", intArr[cnt] );
         printf( "%s\r\n", strArr[cnt] );
         num = strtol( strArr[cnt], NULL, 16 );
         printf( "%x\r\n", num );
     }
     return( rtnCod );
 }


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS