본문 바로가기

code5.4

Python 파이썬의 .replace() 정규식 [중복]을 번역해주세요., python .replace() regex [duplicate] 질문 나는 '' 태그 이후의 모든 것을 잡아내고 삭제하려고 시도하고 있지만, 내 코드는 아무 작업도 수행하지 않는 것 같습니다. .replace()는 정규식을 지원하지 않나요? z.write(article.replace('.+', '')) 답변 No. 파이썬에서 정규 표현식은 re 모듈로 처리됩니다. article = re.sub(r'(?is).+', '', article) 일반적으로: str_output = re.sub(regex_search_term, regex_replacement, str_input) 2023. 11. 3.
Python UnicodeEncodeError: 'charmap' 코덱은 문자를 인코딩할 수 없습니다., UnicodeEncodeError: 'charmap' codec can't encode characters 질문 웹사이트를 크롤링하려고 하는데 오류가 발생합니다. 다음과 같은 코드를 사용하고 있습니다: import urllib.request from bs4 import BeautifulSoup get = urllib.request.urlopen("https://www.website.com/") html = get.read() soup = BeautifulSoup(html) 그리고 다음과 같은 오류가 발생합니다: File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can'.. 2023. 10. 16.
Flutter 플러터: 버튼을 부모 요소의 크기로 확장하는 방법은 무엇인가요?, Flutter: How to make a button expand to the size of its parent? 질문 I am trying to create square buttons, but Expanded doesn't seem to work the same as it does with containers. Take the following code for example new Expanded( flex: 2, child: new Column( children: [ new Expanded( child:new Row( children: [ new Expanded(child: new MaterialButton(...)), new Expanded(child: new MaterialButton(....)), new Expanded(child: new Container(color: Colors.red)), new Exp.. 2023. 10. 1.
Flutter 플러터에서 컨테이너에 투명도를 적용하는 방법은 어떻게 하나요?, How to put opacity for container in flutter 질문 투명도를 적용하려면 16진수 색상 코드를 포함하는 컨테이너에 어떻게 할 수 있을까요? 다음은 현재 코드입니다: final body = Container( width: MediaQuery.of(context).size.width, margin: const EdgeInsets.only(left: 40.0, right: 40.0), padding: EdgeInsets.all(28.0), decoration: new BoxDecoration( color: const Color(0xFF0E3311),//여기에 투명도를 추가하고 싶습니다. border: new Border.all(color: Colors.black54, ), borderRadius: new BorderRadius.only( topLeft: c.. 2023. 9. 24.