Last active
August 29, 2015 14:03
-
-
Save SsonHJ/52449fd7ec2b2f408a7c to your computer and use it in GitHub Desktop.
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
| num = [x*2 for x in range(0,11)] | |
| print num |
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
| sum = 0 | |
| for i in range(1,51): | |
| sum += i | |
| print sum |
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
| for i in range(6): | |
| print "*"*i |
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
| for i in range(2,10): | |
| for j in range(1,10): | |
| print str(i) + "*" + str(j) + "=" + str(i*j) |
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
| from random import randint | |
| lotto = [] | |
| while len(lotto) < 6: | |
| num = randint(0,47) | |
| if not num in lotto: | |
| lotto.append(num) | |
| print lotto |
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 urllib2 | |
| def view_comic_title(pageNum): | |
| response = urllib2.urlopen('http://comic.naver.com/webtoon/list.nhn?titleId=186811&weekday=thu&page=%d'%(pageNum)) | |
| html = response.read().split('<td class="title">') | |
| for data in html[1:]: | |
| # print data | |
| print data.split('</a>')[0].split(')">')[1] | |
| for i in range(1,10): | |
| view_comic_title(i) |
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 urllib2 | |
| def kaist_board(pageNum): | |
| response = urllib2.urlopen('http://www.kaist.ac.kr/_prog/_board/?code=kaist_event&site_dvs_cd=kr&menu_dvs_cd=0602&skey=&sval=&site_dvs=&GotoPage=&GotoPage=%d'%(pageNum)) | |
| html = response.read().split('<td class="title">') | |
| for data in html[1:]: | |
| print data.split('</a>')[0].split("%d'>"%(pageNum))[1] | |
| for i in range(1,10): | |
| kaist_board(i) |
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 | |
| from bs4 import BeautifulSoup | |
| def view_comic_title(pageNum): | |
| htmltext = urllib.urlopen( | |
| 'http://comic.naver.com/webtoon/list.nhn?titleId=186811&weekday=thu&page=%d' % (pageNum)).read() | |
| soup = BeautifulSoup(htmltext, from_encoding="utf-8") | |
| subjects = [] | |
| for tag in soup.select(".title"): | |
| subjects.append(tag.get_text()) | |
| for subject in subjects: | |
| print subject.encode('utf-8') | |
| for i in range(1, 3): | |
| view_comic_title(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment