root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/EGG-INFO/scripts/random_lines.py
| リビジョン 3, 296 bytes (コミッタ: kohda, 15 年 前) |
|---|
| 行番号 | |
|---|---|
| 1 | #!/usr/bin/python2.6 |
| 2 | |
| 3 | """ |
| 4 | Script to select random lines from a file. Reads entire file into |
| 5 | memory! |
| 6 | |
| 7 | TODO: Replace this with a more elegant implementation. |
| 8 | """ |
| 9 | |
| 10 | import sys |
| 11 | import random |
| 12 | |
| 13 | ndesired = int( sys.argv[1] ) |
| 14 | |
| 15 | for line in random.sample( sys.stdin.readlines(), ndesired ): |
| 16 | print line, |
Note: リポジトリブラウザについてのヘルプは TracBrowser
を参照してください。
![(trac.ini の [header_logo] セクションを設定してください)](/bh10.10/chrome/site/your_project_logo.png)