This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def computepay(h,r): | |
if h<=40: | |
pay=h*r | |
elif h>40: | |
pay=40*r+(h-40)*r*1.5 | |
return(pay) | |
hrs = input("Enter Hours:") | |
h = float(hrs) | |
rate = input("Enter rate:") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ../는 이걸 나가겠다. 뜻임 | |
# 줄을 바꾸고 싶다면 역슬러쉬를 항상 그어줘야 한다. | |
f = open('../fff/aaa.txt','w') | |
f.write('query') | |
f.write('aaa') | |
f.write('bbb\n') | |
f.write('ccc') | |
f.close() | |
# 한글이 안깨졌으면 좋겠다. 기본이 utf-8이다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#readline()함수 | |
#한글을 읽으려면 꼭 utf-8을 잊지말자. | |
fa=open('../fff/aaa.txt','r', encoding='utf-8') | |
dd=fa.read() | |
fa.close() | |
print(dd) | |
#한글을 읽으려면 꼭 utf-8을 잊지말자. | |
fa=open('../fff/stud.csv','r') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
shutil.copy('../fff/Chicago.jpg','../mmm/image2.jpg') | |
#시카고 이미지를 mmm폴더의 imgage2로 저장하겠다. | |
shutil.move('../mmm/image2.jpg','../fff/Chicago2.jpg') | |
#mmm폴더의 image2를 다시 fff폴더에 Chicago2이름으로 이동 | |
-------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def order(ih,name='아시아노'): | |
dd = {'아메리카노': 2000, | |
'아프리카노': 3000, | |
'아시아노': 3500} | |
print(name, ih, dd[name]) | |
order('아이스','아메리카노') | |
order('핫','아프리카노') | |
order('아이스') | |
print('----실습----') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
largest = None | |
smallest = None | |
while True: | |
inp = raw_input("Enter a number: ") | |
if inp == "done" : break | |
try: | |
num = float(inp) | |
except: | |
print ("Invalid input") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from lxml.html import parse | |
from io import StringIO | |
url='http://finance.naver.com/sise/sise_market_sum.nhn' | |
text = requests.get(url) | |
ppp = parse(StringIO(text.text)) | |
doc = ppp.getroot() | |
tables = doc.findall('.//table') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from lxml.html import parse | |
from io import StringIO | |
def rowData(rr, kind): | |
cols = rr.findall('.//'+kind) | |
res = [vv.text_content().replace("\t","").replace("\n","") for vv in cols] | |
return res[:-1] | |
def rowWrite(rr): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# developers/facebook.com 으로 접속 | |
import urllib.request as ur | |
import json | |
page_name='jtbcnews' | |
base = "https://graph.facebook.com/v2.8" | |
app_id = "200920440387013" | |
app_secret = "daccef14d5cd41c0e95060d65e66c41d" | |
access_token = app_id+"|"+app_secret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request as ur | |
import json | |
page_name='MBC' | |
base="https://graph.facebook.com/v2.8/" | |
page_id='240263402699918' | |
from_date='2018-01-01' |