python生信练习
1 在文件中创建字符串nN
Create 10 strings in a file, for each string, the first half is
n and the last half is N. The length of the string increase
by 2.
Example:
nN
nnNN
…
nnnnnNNNNN
…
#open函数:file_object=open(file_name,access_mode='r'),access_mode:文件使用模式
n=open('n.txt','w') # r只读,w可写,a追加,创建txt文件
for i in range(1,10):
k=1
while(k<=i):
n.write('n')
k=k+1
k=1
while(k<=i):
n.write('N')
k=k+1
n.write