크롤링을 하다가 보면.. URL에 한글이 들어가야만 하는 경우가 있는데 이 때 본 에러다.

 

URL 내의 한글을 퍼센트 인코딩으로 변경해서 넣어주어야 하는데 아래와 같이 quote 명령어를 통해서 해결이 가능하다.

 

from urllib.parse import quote
quote("서울")

>>'%EC%84%9C%EC%9A%B8'

 

* 레퍼런스

https://ko.wikipedia.org/wiki/%ED%8D%BC%EC%84%BC%ED%8A%B8_%EC%9D%B8%EC%BD%94%EB%94%A9?fbclid=IwAR3Sk_251xX3Y0p4Bp9YsKL2oaBH6Ucf0Gmj8ImjPIuTzeoIvZVjaO_V_4w

 

퍼센트 인코딩 - 위키백과, 우리 모두의 백과사전

위키백과, 우리 모두의 백과사전. 퍼센트 인코딩(percent-encoding)은 URL에 문자를 표현하는 문자 인코딩 방법이다. 이 방법에 따르면 알파벳이나 숫자 등 몇몇 문자를 제외한 값은 옥텟 단위로 묶어서, 16진수 값으로 인코딩한다. '위키백과'의 인코딩 인코딩 UTF-8 EUC-KR 16진수 표현 EC 9C 84 ED 82 A4 EB B0 B1 EA B3 BC C0 A7 C5 B0 B9 E9 B0 FA 퍼센트 인코딩 %EC%9C%84%ED%82

ko.wikipedia.org

 

반응형
Posted by JoeSung
,

 

django로 회원가입 기능 구현을 하게되면 로그인시에 username으로 로그인을 해야되는 번거로움을 만나게 된다. 요즘의 상용서비스들이라면 대개 email을 회원가입 구분자로 사용하는 경우가 많기 때문에 기본 세팅을 변경해줘야만 한다. 아래의 레퍼런스를 통해서 해결해보자

 

*레퍼런스

 

https://wsvincent.com/django-login-with-email-not-username/

 

Django Log In with Email not Username - Will Vincent

Django was first released in 2005 and since then a lot has changed in web development, notably the predominant pattern at the time of using username/email/password has been simplified to just email/password. However due to legacy reasons around the built-i

wsvincent.com

 

https://kamang-it.tistory.com/entry/Django-10login-logout

 

[Django-10]login, logout

참고: [Web Applicateion]서버 사이드와 클라이언트 사이드,백앤드와 프론트앤드 pip install django로 반드시 장고를 설치하여야한다. 또한 장고의 버전은 2이므로 1을 사용하는 사람들의 경우 서로 많이 차이날..

kamang-it.tistory.com

 

반응형
Posted by JoeSung
,

terminal을 열고


>> pip3 install --upgrade pip

업데이트 한번 실행


>> pip3 install jupyter

pip3로 주피터 설치. 파이썬3을 쓰기 때문에 pip3으로 시도


>> jupyter notebook

주피터 노트북 실행

반응형
Posted by JoeSung
,


Simple is Better Than Complex


In [64]: import this


The Zen of Python, by Tim Peters


Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren't special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

There should be one-- and preferably only one --obvious way to do it.

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.

Although never is often better than *right* now.

If the implementation is hard to explain, it's a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!




-------


파이썬 다시 시작

반응형
Posted by JoeSung
,