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
num = 12452 | |
print num | |
print str(num)[::-1] | |
## 2進数の場合 | |
print bin(num).split("0b")[1] | |
print bin(num).split("0b")[1][::-1] |
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 datetime | |
today = datetime.date.today() | |
## 今日 | |
print today | |
""" | |
2015-07-18 | |
""" | |
##日付の計算 |
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 collections | |
import re | |
def find_(text): | |
text = text.replace(" ","") | |
text = text.lower() | |
text = re.sub('[\W_]+','',text) | |
text = re.sub('\d+','',text) | |
count_dict = collections.Counter(text) | |
#tmp = count_dict.most_common(1) | |
max_dict = dict((k, v) for k, v in count_dict.items() if v == max(count_dict.values())) |
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
new_list = [] | |
for el in test_list: | |
if test_list.count(el) > 1: | |
new_list.append(el) |
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
for el in test_list: | |
if test_list.count(el) > 0: | |
print test_list.count(el) |