python 用if和while语句制作一个长300宽100的长方形
课程设计
1
帮帮我 实验室的实在是写不出来了就是用if和while语句制作一个长300宽100的长方形然后长方形里在做一个长宽任意的长方形,在这个长方形中在做一个长方形,就是有三层长方形然后最里面的一层和第二层之间要用东西填充好,填充厚度是5
-
inputfile = input('输入文件路径:')#此处输入绝对路径 inlist = [] with open(inputfile,'r') as file: file = file.readlines() for line in file:inlist.append(line) def func1(): with open('out1.txt','w') as outfile1: with open('out3.txt','w') as outfile3: for lines in inlist: if 'ACATGCGT' in lines:outfile1.write(lines) if 'AGCCTTAG' in lines:outfile1.write(lines) else:outfile3.write(lines) def func2(n=0): with open('out2.txt','w') as outfile2: while n < len(inlist): if inlist[n][0]=='@': while 1: outfile2.write(inlist[n].strip('@')) n +=1 if n == len(inlist):break if inlist[n][0]=='@':break n +=1 func1() func2()
发表回复