我有这个列表['MEYFDAHCHLNCEPLLSEIEKSIANFKLINLKANVVGTDLDNSKIAVELAKKYPDLLKATIGIHPNDVHLVDFKKTKKQLNELLINNRNFISCIGEYGFDYHYTTEFIELQNKFFEMQFEIAETNKLVHMLHIRDAHEKIYEILTRLKPTQPVIFHCFSQDINIAKKLLSLKDLNIDIFFSIPGIVTFKNAQALHEALKIIPSELLLSETDSPWLTPSPFRGKVNWPEYVVHTVSTVAEIKKIEIAEMKRIIVKNAKKLFWH']
我已将其保存到名为proteinseq
的列表中,并希望将其单独拆分,以便只能打印前20个字符。我怎么能在python中这样做?
答案 0 :(得分:4)
看起来您的列表中只有1个项目。
proteinseq[0][:20] # Get up to the 20 characters from the 1st item in the list