【发布时间】:2020-03-21 22:49:49
【问题描述】:
我不知道为什么这些代码行会突然停止工作。 我刚刚在 jupyter notebook 上重新启动了我的内核,但无论出于何种原因,它都没有将字符串写入我指定的文本文件。我的代码是这样的:
Code = 'H His\nQ Gln\nP Pro\nR Arg\nL Leu\nD Asp\nE Glu\nA Ala\nG Gly\nV Val\nY Tyr\n STP\nS Ser\nC Cys\nW Trp\nF Phe\nN Asn\nK Lys\nT Thr\nS Ser\nI Ile\nM Met'
f=open('AA_Codon_code.txt','w+')
f.write(Code)
f.close
文本文件突然没有任何内容,即使它显示在我的目录中。文本文件中没有文本。
当我尝试读取数据时果然是空的。
data = open('AA_Codon_code.txt','r')
amino_acids = data.read()
peptide_dict = {}
amino_acids
这个方法我用过很多次了,但是现在不行了。为什么会这样?
我只想要一个 .txt 文件,上面写着这个字符串:
'H His\nQ Gln\nP Pro\nR Arg\nL Leu\nD Asp\nE Glu\nA Ala\nG Gly\nV Val\nY Tyr\n STP\nS Ser\nC Cys\nW Trp\nF Phe\nN Asn\nK Lys\nT Thr\nS Ser\nI Ile\nM Met'
【问题讨论】: