Pythonでリストやタプルの全要素の個数は組み込み関数len()、各要素の個数(要素ごとの出現回数)はcount()メソッドで取得できる。さらに、Python標準ライブラリcollectionsのCounterクラスを使うと、出現回数が多い順に要素を取得可能。
白ヤギの開発者の森本です。 白ヤギでは Go 言語でニュース記事のキュレーションをする カメリオ API というサービスを開発しています。約1年2ヶ月前、Go を使って開発し始めたときに当時調べた内容を整理して以下の記事を書きました。 Go言語で API サーバーを開発する 1年以上に渡り開発を継続してきて変わったこと、変わってないことなどをざっくばらんにまとめてみます。たまたま過去の記事のはてブコメントを見返していて 以下のコメント を見つけました。 最近 golang 導入事例増えて来たけど、導入後一年くらいのメンテナンスフェーズな事例について聞いてみたい。継続的デリバリーみたいなの。まだ早いのかな? まだまだメンテナンスフェーズにはなっていなくて現在も活発に開発中ですが、継続的デリバリーについて白ヤギでは特別なことをしてなく、ansible を使ってデプロイしているのみです。Go 1
Recipes¶ This is a collection of code snippets and examples for common use cases. Keeping track of Sessions¶ There is no built-in support for sessions because there is no right way to do it (in a micro framework). Depending on requirements and environment you could use beaker middleware with a fitting backend or implement it yourself. Here is an example for beaker sessions with a file-based backen
turtleモジュール(en, ja)には、タートルグラフィックスを描くための関数が定義されています。 以下のサンプルをみてください。 # square.py import turtle def square(n): for i in range(4): turtle.forward(n) turtle.right(90) square(30) turtle._root.mainloop()このスクリプトを実行するとウィンドウが表示されてから、亀(矢印)が正方形を描きます(下図)。 > python square.py リファレンスにturtleモジュールで定義されている関数について説明がありますが、forward関数は亀を引数だけ前進させます。right関数は亀を引数(角度は度)だけ右を向かせる関数です。つまりsquare関数では、 nだけ前進 90度右向くを亀に繰り返し命令する事で亀に
24.1.1. はじめに¶ タートルグラフィックスは子供にプログラミングを紹介するのによく使われます。タートルグラフィックスは Wally Feurzig と Seymore Papert が 1966 年に開発した Logo プログラミング言語の一部でした。 Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an import turtle, give it the command turtle.forward(15), and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.right(25), and it rot
このコンテンツを更新しなくなって久しく、さらにレンタルサーバーのPHPもずっと古いバージョンを使うわけにいかず、従来のdocuwikiを使うのをやめました。全ての内容を静的なHTMLにするのが割と手間なため、手抜きとして、ここの表紙以外をPDFに直してしまいました。これで保存します。python2用なので利用価値もすでに少ないですけどね。 っていうか、実際は動物さんイラスト集サイト。pythonの話はオマケ。 スクリプトが書けると、多分どっかで何かの役に立ちます。決まりきった仕事をチマチマと手作業でやるような場面で、スクリプトを上手に書けると劇的に楽になったりすることもあります。筆者自身がそういう経験を持っているので、他にも同じようなことができる人が現れてほしい。こういった動機で、習得用のテキストをポチポチと書き続けています。 興味はある(or 必要に迫られている)んだけど、本当に何も知ら
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く