Help us understand the problem. What is going on with this article?

BLASTの結果っぽい文字列の表示

More than 1 year has passed since last update.

試しに。
複数の同じ長さの文字列を並べて表示したい時のための方法。BLASTなどの結果と似た感じの出力。

from math import ceil

hoge = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
fuga = "abcdefghijklmnopqrstuvwxyz"

def multi_line(str_list, col_length):
    # str_list内の文字列の長さは同じとする
    for k in range(int(ceil((float(len(str_list[0])))/col_length))):
        e = (k + 1)*col_length if (k+1)*col_length < len(str_list[0]) else len(str_list[0])
        for s in str_list:
            print s[k*col_length:e]
        print "\n"

multi_line([hoge, fuga], 13)
# This will produce:
# ABCDEFGHIJKLM
# abcdefghijklm
#
# NOPQRSTUVWXYZ
# nopqrstuvwxyz
#
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした