下記のコードを実行すると、spyderでは実行できるのに
jupyternote bookではエラーコードが出てしまいます。
なぜでしょうか。
import more_itertools as mit def consecutive_groups(iterable): """Yield range of consecutive numbers.""" for group in mit.consecutive_groups(iterable): group = list(group) if len(group) == 1: yield group[0] else: yield group[0], group[-1] path = 'pdb1ufq.ent' serial_numbers_A = [] serial_numbers_B = [] with open(path) as f: lines = f.readlines() lines_strip = [line.strip() for line in lines] #A側のCAの抽出------------------------------------ for A_and in lines: A_and=A_and.split() if A_and[0] == 'ATOM' and A_and[2] == 'CA' and A_and[4] == 'A': serial_numbers_A.append(int(A_and[5])) print("A側のCA") for Agroup in consecutive_groups(serial_numbers_A): print(list(Agroup)) #B側のCAの抽出------------------------------------- for B_and in lines: B_and=B_and.split() if B_and[0] == 'ATOM' and B_and[2] == 'CA' and B_and[4] == 'B': serial_numbers_B.append(int(B_and[5])) print("------------------------------------------") print("B側のCA") for Bgroup in consecutive_groups(serial_numbers_B): print(list(Bgroup)) コード
エラーコード
A側のCA --------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-56-7a4442a92740> in <module> 26 27 print("A側のCA") ---> 28 for Agroup in consecutive_groups(serial_numbers_A): 29 print(Agroup) 30 <ipython-input-56-7a4442a92740> in consecutive_groups(iterable) 4 """Yield range of consecutive numbers.""" 5 for group in mit.consecutive_groups(iterable): ----> 6 group = list(group) 7 if len(group) == 1: 8 yield group[0] TypeError: 'list' object is not callable
なにが駄目なのでしょうか。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。