将字符串列表写出到文件中

0 python bioinformatics biopython

我有一个缩写列表

字母= ['Ala','Asx','Cys',......'Glx']

我想将其输出到一个文本文件,看起来像这样:

#Letters
Ala,Asx,Cys,..... Glx

Noob程序员在这里!我总是忘记最简单的事情!啊

请帮助和谢谢!

import Bio
from Bio import Seq
from Bio.Seq import Alphabet

output = 'alphabetSoupOutput.txt'
fh = open(output, 'w')
ThreeLetterProtein = '#Three Letter Protein'
Letters = Bio.Alphabet.ThreeLetterProtein.letters
fh.write(ThreeLetterProtein + '\n')

  #Don't know what goes here

fh.close()
Run Code Online (Sandbox Code Playgroud)

Dan*_*rov 5

怎么样fh.write(', '.join(Letters))