In the early days of C, you’d occasionally see someone — probably a former Pascal programmer — write something like this: #define BEGIN { #define END } This would usually initiate complaints about ...
Day 21。今日はPythonの基礎をがっつり学びました。変数の使い方から始まって、リストの操作、for文との組み合わせ、リスト内包表記まで一気に進んだ、かなり濃い一日でした。 変数 — 名前のついた箱 変数は「データに名前をつけて後から使えるようにする ...
Pythonでファイル操作の自動化スクリプトを書いていると、「あるディレクトリ(フォルダ)の中身をまるごとZIPファイルに圧縮したい」という要件は頻繁に発生します。 このとき、真面目なエンジニアほど標準ライブラリの zipfile モジュールを使い、os.walk () でディレクトリツリーを再帰的に ...
CTC教育サービスはコラム「ゼロから歩くPythonの道> 第71回 Pythonのインデックスの考えと、ループ処理を簡単にするenumerate()」を公開しました。 こんにちは、吉政創成 菱沼です。 今回も「きれいなPythonプログラミング(マイナビ出版)」という書籍を利用し ...
In the following example, we loop through a list of numbers, and use the variable digit to hold each number in turn: Strings in Python are considered “sequences” — they can be iterated over, and the ...
Python is a general-purpose programming language for Web and desktop development. Python works well on both of these platforms because of its flexibility, facilitated by its extensive list of built-in ...
If you’ve ever written any Python at all, the chances are you’ve used iterators without even realising it. Writing your own and using them in your programs can provide significant performance ...