일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- string
- dataframe
- SQL
- Tkinter
- Kotlin
- Java
- list
- math
- Excel
- hive
- Google Spreadsheet
- Github
- c#
- Mac
- django
- Redshift
- google apps script
- PANDAS
- gas
- numpy
- PySpark
- Google Excel
- Python
- GIT
- Apache
- matplotlib
- 파이썬
- array
- PostgreSQL
- Today
- Total
목록Python (379)
달나라 노트
Python에서는 변수에 숫자나 글자같은 단순한 값 뿐 아니라 여러 값들을 묶어놓은 묶음(collection)을 할당할 수 있습니다. Python에 있는 묶음 데이터(collection)들은 어떤 것이 있으며 각각의 특성이 무엇인지 알아봅시다. 1. list temp_list = [1, 1, 2, 'a', 'bb', '1a2b3c'] temp_list_2 = ['apple'] 가장 먼저 list입니다. 가장 많이 쓰이는 형태입니다. list는 위처럼 대괄호[]로 묶어서 변수에 할당할 수 있습니다. 대괄호 안에는 각각의 요소들이 콤마의 형태로 구분지어져 있습니다. (요소란 collection 안에 있는 하나하나의 구성품들을 의미합니다.) temp_list_2에서 보이는 것 처럼 list 속 요소는 1개일수..
Python에 있는 phonenumbers library는 입력한 핸드폰 번호의 간단한 정보를 알려줍니다. 바로 코드를 봅시다. import phonenumbers from phonenumbers import carrier, geocoder, timezone mobile_phone_number = '+821012345678' mobile_phone_number = phonenumbers.parse(mobile_phone_number) print('Time zone of the number ->', timezone.time_zones_for_number(mobile_phone_number)) print('Country of the number ->', geocoder.description_for_numbe..
회원가입을 할 때 보면 정보를 다 입력하고 마지막 부분에 이상하게 생긴 문자들을 입력하라고 하는것이 보통입니다. 위 이미지처럼요. 위와같은 것을 주로 Captcha라고 하는데 이번에는 Python으로 위 이미지처럼 특정 문자를 captcha로 만들어보겠습니다. pip install captcha 먼저 captcha library를 설치해줍니다. from captcha.image import ImageCaptcha image = ImageCaptcha(width=160, height=90) txt_captcha = '3ck8Bei' image.generate(txt_captcha) image.write(txt_captcha, 'captcha_result.png') 위 코드를 실행해보면 아래처럼 내가 원하는..
Python의 datetime library에는 utcnow라는 method가 있는데 이것은 현재 기준 UTC를 반환해줍니다. import datetime dt_utc = datetime.datetime.utcnow() print(dt_utc) -- Result 2021-10-27 17:08:51.097881 사용법은 상당히 간단합니다. utcnow() method만으로 UTC를 얻을 수 있습니다. utcnow()는 Python코드를 실행하는 서버나 컴퓨터의 시간에 상관없이 UTC값을 기준으로 계산되는 것이므로, 혹시나 컴퓨터의 시간이 이상하다거나 사용하는 서버의 시간이 이상할 경우 정확한 현재 시간/날짜를 얻기 위해 사용할 수 있습니다. import datetime dt_kst = datetime.da..