python magic packages

 

pip3 install emoji

import emoji
result = emoji.emojize('Python is :thumbs_up:')
print(result)
# 'Python is 👍'

# You can also reverse this:
result = emoji.demojize('Python is 👍')
print(result)
# 'Python is :thumbs_up:'

 

dataclasses

from dataclasses import dataclass

@dataclass
class Card:
    rank: str
    suit: str
    
card = Card("Q", "hearts")

print(card == card)
# True

print(card.rank)
# 'Q'

print(card)
Card(rank='Q', suit='hearts')

 

Out-of-Core DataFrames for Python, ML, visualize and explore big tabular data at a billion rows per second

 

Pillow 显示图片

pip3 install Pillow

 

pip3 install progress

from progress.bar import Bar

bar = Bar('Processing', max=20)
for i in range(20):
    # Do some work
    bar.next()
bar.finish()

 

pip3 install python-dateutil

from dateutil.parser import parse

logline = 'INFO 2020-01-01T00:00:01 Happy new year, human.'
timestamp = parse(logline, fuzzy=True)
print(timestamp)
# 2020-01-01 00:00:01

 

posted @ 2020-06-02 15:46  similarface  阅读(240)  评论(0编辑  收藏  举报