This file contains 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 sys | |
import requests | |
from bs4 import BeautifulSoup | |
def search_daum_dic(query_keyword): | |
dic_url = """http://dic.daum.net/search.do?q={0}""" | |
r = requests.get(dic_url.format(query_keyword)) | |
soup = BeautifulSoup(r.text, "html.parser") | |
result_means = soup.find_all(attrs={'class':'list_search'}) |
This file contains 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
score = input('Input score : ') | |
score_num = int(score) | |
if score_num >= 90: | |
print('A') | |
elif score_num >= 80 and score_num < 90: | |
print('B') | |
elif score_num >= 70 and score_num < 80: | |
print('C') | |
elif score_num >= 60 and score_num < 70: |
This file contains 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
id | 도도부현 | 인구(명) | 면적(km2) | |
---|---|---|---|---|
1 | 도툐도 | 120202 | 2012.02 | |
2 | 가나가와현 | 90000 | 2416.02 | |
3 | 치바현 | 620000 | 5081.02 | |
4 | 사이타마현 | 720000 | 3767.02 |
This file contains 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
from openpyxl import Workbook | |
from openpyxl.styles import Font, PatternFill | |
wb = Workbook() | |
dest_filename = 'empty_book.xlsx' | |
ws1 = wb.active | |
ws1.title = u"샘플" | |
ws1['A1'] = '과일종류' |
This file contains 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
fish = "<(((====<<<" | |
print(fish[0:4]) | |
print(fish[4:8]) | |
print(fish[8:]) |
This file contains 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
# string | |
x = "Beautiful is better than ugly" | |
for c in x: | |
print(c) | |
# list | |
l = [1, 2, 3, 4, 5, 6, 7] | |
for item in l: | |
print(item) |
This file contains 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
x_range = range(2, 10) | |
y_range = range(1, 10) | |
for x in x_range: | |
for y in y_range: | |
print('%d X %d = %d' % (x, y, x * y)) | |
print('*' * 20) |
This file contains 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
Show hidden characters
{ | |
"cmd": ["/usr/local/bin/python3", "$file"], | |
"selector": "source.python", | |
"file_regex": "file \"(...*?)\", line ([0-9]+)", | |
"env":{"LANG": "en_US.UTF-8"} | |
} |
This file contains 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
# -*- coding:utf8 -*- | |
import csv | |
# read | |
with open('eggs.csv', 'rb') as csvfile: | |
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|') | |
for row in spamreader: | |
print ', '.join(row) | |
# append |
NewerOlder