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 re | |
# http://stackoverflow.com/a/13752628/6762004 | |
RE_EMOJI = re.compile('[\U00010000-\U0010ffff]', flags=re.UNICODE) | |
def strip_emoji(text): | |
return RE_EMOJI.sub(r'', text) | |
print(strip_emoji('ππ€')) |
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
# coding=utf8 | |
import re | |
def escape_emoji(txt): | |
try: | |
chars = re.compile(u'[\U00010000-\U0010ffff]') | |
except re.error: | |
chars = re.compile(u'[\uD800-\uDBFF][\uDC00-\uDFFF]') |
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
print binascii.a2b_hex('xE5xBDxB1xE5x93x8DxE4xB8x80xE7x94x9FxE7x9Ax84xE8x80x81xE5xB8x88'.replace("x","")) |
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
# -*- encoding: utf-8 -*- | |
import string | |
import re | |
RE_PUCTUATION= '[\s+\.\!\/_,$%^*()+\"\']+|[+ββοΌοΌγοΌγ~@#οΏ₯%β¦β¦&*οΌοΌγγοΌοΌ&%οΏ₯#@οΌ{}γγ]+' | |
def filter_puctuation(ch_str): | |
str_res = '' |
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
# -*- encoding:utf-8 -*- | |
class B(object): | |
def __call__(self, name): | |
return getattr(self, name) | |
def noattr(self, text): | |
print 'noattr' + text | |
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
#-*- coding:utf-8 -*- | |
import datetime | |
import time | |
#δ½Ώη¨format | |
d1 = datetime.date(2013, 12, 25) | |
print format(d1) | |
#out : 2013-12-25 |
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
#coding:utf-8 | |
import csv | |
import sys | |
####write | |
info = [(1,2,3), | |
(2,3,4), |
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
#coding:utf-8 | |
""" | |
εε ΈζεΌζεΊ | |
""" | |
import operator | |
res = {'a':2, 'b':1} | |
sorted_res = sorted(res.iteritems(), key=operator.itemgetter(1)) |