분류 전체보기72 파이썬 정규식, 파일 제목으로 쓸 수 없는 기호 제거하기 import re filename = "My/[Fil]e?:Name.txt" not_allowed = r"[\\\/\:\*\?\"\\|]" clean_filename = re.sub(not_allowed, "", filename) 2023. 3. 24. 파이썬 반올림 반올림 round(숫자) 올림 import math math.ceil(숫자) 내림 import math math.floor(숫자) 버림 math.trunc(숫자) 2023. 3. 24. 파이썬 메모장 파일 읽어오기, 입력하기 읽어오기 text = open('test.txt', 'rt', encoding='utf-8').read() 입력하기 txt_file = open('test.txt', 'w', encoding='utf-8') txt_file.write(desc) 2023. 3. 23. 파이썬 파일 열려있는지 확인 myfile = None try: if os.path.exists(path) : myfile = open(path, "r+") myfile.close() except IOError: print('파일이 열려있음') return 2023. 3. 22. 닭볶음탕 소소황 유튜브 가족 손님 물을 적게 시작하기 청주에 2023. 3. 20. 이전 1 ··· 6 7 8 9 10 11 12 ··· 15 다음