BackEnd/Automation Program with Python
2023.01.19
from pandas import Series #matplotlib, pandas_datareader #Series1 선언 series1 = Series([92600, 92400, 92100, 94300, 92300]) #출력 print(series1) #총 개수 print('count',series1.count()) #요약 print('count',series1.describe()) #인덱스 접근 print(series1[0]) #Series2 선언 series2 = Series([92600, 92400, 92100, 94300, 92300], index=['2018-02-19','2018-02-18','2018-02-17','2018-02-16','2018-02-15']) #출력2 print(seri..
BackEnd/Automation Program with Python
2023.01.19
import simplejson as json # import json #Dict(json) 선언 data = {} data['people'] = [] data['people'].append({ 'name':'KUK', 'website':'naver.com', 'from':'seoul' }) data['people'].append({ 'name':'Lee', 'website':'google.com', 'from':'kyungki' }) data['people'].append({ 'name':'park', 'website':'daum.net', 'from':'pusan' }) print(data) # data = {'people': [{'name': 'KUK', 'website': 'naver.com', ..
BackEnd/Automation Program with Python
2023.01.18
기상청 xml 데이터 지역별 시간대별 최고 최저 온도 수집 import sys import io import urllib.request as req from bs4 import BeautifulSoup import os.path # 다운로드 url url = 'https://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=108' savename = 'C:/forecast.xml' if not os.path.exists(savename): req.urlretrieve(url, savename) # Beautifulsoup 파싱 xml = open(savename, 'r', encoding="utf-8").read() soup = BeautifulSoup(..
BackEnd/Automation Program with Python
2023.01.18
import pickle #(객체, 텍스트) 직렬화, 역직렬화 # 파일이름과 데이터 bfilename = 'C:/test.bin' tfilename = 'C:/test.txt' data1 = 77 data2 = 'hello world' data3 = ['car', 'apple', 'house'] # 바이너리 쓰기 with open(bfilename, 'wb') as f: pickle.dump(data1,f) #dumps(문자열 직렬화) pickle.dump(data2,f) pickle.dump(data3,f) # 텍스트 쓰기 with open(tfilename, 'wt') as f: f.write(str(data1)) f.write('\n') f.write(data2) f.write('\n') f.wri..
BackEnd/Automation Program with Python
2023.01.17
import sys import io from bs4 import BeautifulSoup import requests sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8') sys.stddrr = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8') # 로그인 유저정보 LOGIN_info = { 'user_id' : 'test_id_1234', 'user_pw' : 'test_pw_1234!' } # Session 생성 with 구문 안에서 유지 with requests.Session() as s: login_req = s.post('https://user.ruliweb.com/me..