Pattern2 decorator - 데커레이터 decorator 패턴은 '@'표기를 사용해 함수 또는 메서드의 변환을 우아하게 지정해준다'함수의 객체'와 '함수를 변경하는 다른 객체'의 wrapping을 허용한다@decodef method(arg): # method... passdecorator 를 사용한 위 코드는 아래코드와 같다def method(arg): # method... passmethod = deco(method)import functoolsimport timeline_len = 80def clen(s): """Calculate the effective length of a string considering full-width characters.""" return sum(1 if ord(c) >= 0x2E80 else.. 2024. 10. 30. [HTML5] 옵션 patten DescriptionPattern Credit Card Number [0-9]{13,16} Diners Club Card ^([30|36|38]{2})([0-9]{12})$ ICQ UIN ([1-9])+(?:-?\d){4,} Alpha-Numeric ^[a-zA-Z0-9]+$ Domain like "abc.de" ^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$ IPv4 Address ((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$ IPv6 Address ((^|:)([0-9a-fA-F]{0,4})){1,8}$ Username with 2-20 chars (format: string+stri.. 2012. 8. 1. 이전 1 다음