일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
31 |
- Redshift
- math
- PySpark
- Google Spreadsheet
- Python
- hive
- list
- matplotlib
- Github
- numpy
- Google Excel
- array
- Tkinter
- Kotlin
- gas
- string
- google apps script
- SQL
- c#
- Java
- django
- Mac
- Apache
- 파이썬
- GIT
- dataframe
- Excel
- PostgreSQL
- PANDAS
- Today
- Total
목록Python (384)
달나라 노트
import ftplib s3_host = '11.111.111.111' s3_user_id = 'user_1' s3_user_password = 'pw_1' ftp = ftplib.FTP() ftp.encoding = 'utf-8' ftp.connect(s3_host) # connect to s3 ftp.login(s3_user_id, s3_user_password) # login to s3 # show current directory print('Current directory :', ftp.pwd()) ftp.quit() # quit s3 - Output Current directory : / ftplib의 pwd는 현재 디렉토리를 출력해줍니다. 로그인한 후의 Directory는 root direc..
import ftplib s3_host = '11.111.111.111' s3_user_id = 'user_1' s3_user_password = 'pw_1' ftp = ftplib.FTP() ftp.encoding = 'utf-8' ftp.connect(s3_host) # connect to s3 ftp.login(s3_user_id, s3_user_password) # login to s3 ftp.quit() # quit s3 ftplib를 이용한 s3 server로의 로그인은 위처럼 가능합니다.
Python의 map 함수는 반복 가능한 객체(iterable)를 받아서 각 요소에 어떠한 함수를 적용시켜서 반환합니다. map(function, iterable) map 함수는 첫 번째로 적용시킬 함수(function)를 인자로 받고, 두 번째로 iterable 객체를 받습니다. list_test = [1, 2, 3, 4, 5] def multiply(x): return x * 2 list_new = list(map(multiply, list_test)) print(list_new) - Output [2, 4, 6, 8, 10] 위 코드를 봅시다. 만약 list_test의 각각의 요소에 2를 곱한 list를 얻고싶다면 map함수를 사용할 수 있습니다. 이를 위해 multiply라는 함수를 선언하였습니다..
Web 페이지의 HTML코드를 가져온 다음에는 정보를 선택하는 작업이 필요합니다. 가져온 HTML 코드에서 내가 원하는 부분만 추출할 수 있어야 한다는 뜻입니다. import requests from bs4 import BeautifulSoup as bs URL = "https://www.naver.com" rq = requests.get(URL) soup = bs(rq.content, 'html.parser') li_list = soup.find_all('div', class_ = 'sc_timesquare') for li in li_list: ul = li.select('ul > li') for l in ul: print(l.get_text()) - Output 미세좋음 초미세좋음 위 코드를 봐봅시다..