<s> import os <EOL> print ( "<STR_LIT>" ) <EOL> test_digits_folder = os . path . normpath ( os . path . join ( os . path . join ( os . getcwd ( ) , os . path . dirname ( __file__ ) ) , '<STR_LIT>' ) ) <EOL> test_digits_file_path = os . path . join ( os . path . join ( os . getcwd ( ) , os . path . dirname ( __file__ ) ) , '<STR_LIT>' ) <EOL> for ( dirpath , dirnames , filenames ) in os . walk ( test_digits_folder ) : <EOL> test_digit_content = '<STR_LIT>' <EOL> for file_name in filenames : <EOL> test_file_path = os . path . normpath ( os . path . join ( dirpath , file_name ) ) <EOL> digit_class = file_name [ <NUM_LIT:0> : <NUM_LIT:1> ] <EOL> one_line_string = '<STR_LIT>' <EOL> with open ( test_file_path ) as f : <EOL> for line in f : <EOL> space_line = "<STR_LIT:U+0020>" . join ( line ) . rstrip ( ) + "<STR_LIT:U+0020>" <EOL> one_line_string = one_line_string + space_line <EOL> one_line_string = one_line_string + digit_class + "<STR_LIT:\n>" <EOL> test_digit_content = test_digit_content + one_line_string <EOL> target_file = open ( test_digits_file_path , '<STR_LIT:w>' ) <EOL> target_file . write ( test_digit_content ) <EOL> target_file . close ( ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> train_digits_folder = os . path . normpath ( os . path . join ( os . path . join ( os . getcwd ( ) , os . path . dirname ( __file__ ) ) , '<STR_LIT>' ) ) <EOL> train_digits_file_path = os . path . join ( os . path . join ( os . getcwd ( ) , os . path . dirname ( __file__ ) ) , '<STR_LIT>' ) <EOL> for ( dirpath , dirnames , filenames ) in os . walk ( train_digits_folder ) : <EOL> train_digit_content = '<STR_LIT>' <EOL> for file_name in filenames : <EOL> train_file_path = os . path . normpath ( os . path . join ( dirpath , file_name ) ) <EOL> digit_class = file_name [ <NUM_LIT:0> : <NUM_LIT:1> ] <EOL> one_line_string = '<STR_LIT>' <EOL> with open ( train_file_path ) as f : <EOL> for line in f : <EOL> space_line = "<STR_LIT:U+0020>" . join ( line ) . rstrip ( ) + "<STR_LIT:U+0020>" <EOL> one_line_string = one_line_string + space_line <EOL> one_line_string = one_line_string + digit_class + "<STR_LIT:\n>" <EOL> train_digit_content = train_digit_content + one_line_string <EOL> target_file = open ( train_digits_file_path , '<STR_LIT:w>' ) <EOL> target_file . write ( train_digit_content ) <EOL> target_file . close ( ) <EOL> print ( "<STR_LIT>" ) </s>
