creating wrong encoded filenames
from random import randint, choice def get_char(): return randint(1, 255) def make_file_name(): return bytes(get_char() for _ in range(randint(5, 10))) def create_files(n): for _ in range(n): try: open(make_file_name(), "w").close() except (FileNotFoundError, IsADirectoryError): # don't ask, why there could be a IsADirectoryError # but it demostates how bad it is to use broken unicode # for filenames pass if __name__ == "__main__": create_files(20)
Comments
0 B
|👍
/👎