ptk(Python Prompt Toolkit)とは Xonshよりはよっぽど有名なライブラリなので説明はいらないかもしれないですが、簡単に言うとpure pythonのreadlineみたいなものです。 readlineに対して、multilineに対応していたり高度な補完や編集を提供していたり、初めて使うと結構驚く便利なライブラリです。 早速余談をすると、確か2年くらい前に自分がXonshを試したときは真っ白の画面に不安定なフォント、激重レスポンスみたいな状態で、コンセプトには感動するけど実用はちょっとなあという感じでした。 日本語版arch wikiを見ると未だにこんなふうに書かれているくらいです。(2017/11/18時点) それが最近触ってみたらptkのおかげでデフォルトでfish並の見た目と補完を備えていて、大層たまげたという個人的な体験があったりします。 それくらいptk
Python debugging tools 05 June 2013 (updated 17 February 2016) This is an overview of the tools and practices I've used for debugging or profiling purposes. This is not necessarily complete, there are so many tools so I'm listing only what I think is best or relevant. If you know better tools or have other preferences, please comment below. Logging * Yes, really. Can't stress enough how important
Background I have been debugging my python scripts for ~2 years with plain from IPython import embed; embed(), and it has been working really fine. I just place the command on the line I want to examine, and when running the script I will have full IPython shell with capability for examining variables, defining functions, etc. On top of that, IPython shell comes with variable name tab completion.
What is PyPika? PyPika is a Python API for building SQL queries. The motivation behind PyPika is to provide a simple interface for building SQL queries without limiting the flexibility of handwritten SQL. Designed with data analysis in mind, PyPika leverages the builder design pattern to construct queries to avoid messy string formatting and concatenation. It is also easily extended to take full a
最近、友人の運営する大学講義の検索サイトを、機械学習で良い感じにしてます。 地味に悩んだのが「JSON形式でのデータ入出力」の部分。具体的には、「JSON形式で渡されたデータに、推定結果の一部numpyオブジェクトを加えたJSONデータを返す」作業。 Pythonなど動的言語はデータ型をよしなに判断してくれますが、少し例外に触れた時には指定してあげる必要があります。 今回はその例外のためにクラスを自作して指定する方法を備忘録。 問題 解決策 最後に 参考記事 問題 何も引数に指定せず、ただ以下の様にjson.dumps()メソッドにnumpy.int64などを渡すと、以下の様なエラーに遭遇する。 json.dumps(numpy.int64(111)) ---------------------------------------------------------------------
IntroductionScrapy is a free and open-source web crawling framework written in Python. It allows you to send requests to websites and to parse the HTML code that you receive as response. With Scrapyrt (Scrapy realtime), you can create an HTTP server that can control Scrapy through HTTP requests. The response send by the server are data formatted in JSON containing the data scraped by Scrapy. It ba
PythonのWebクローリングとスクレイピングのフレームワークであるScrapyの使い方をサンプルコードとともに説明する。 Scrapy | A Fast and Powerful Scraping and Web Crawling Framework 以下の内容について説明する。具体例はYahoo! Japanを対象としている。 クローリングとスクレイピング ScrapyとBeautifulSoupの違い Scrapyのインストール Scrapyの基本的な使い方 単独のページをスクレイピングする例 リンクを指定してクローリング、スクレイピングする例 リンクを抽出してクローリング、スクレイピングする例 リンクを抽出して再帰的にクローリング、スクレイピングする例 Scrapyのバージョンは1.5.0。バージョン1.1からPython3にも対応している。 レポジトリは以下。 nkmk/scr
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く