python 在同一行打印_在python中以同一行打印

我已经修复了缩进和冗余:#!/usr/bin/python

"""

This script reads the sequences of the desert areas (fasta files) and calculates the percentage of the Ns and the repeats.

2014-10-05 v1.0 by Vasilis

2014-10-05 v1.1 by Llopis

2015-02-27 v1.2 by Cees Timmerman

"""

import argparse

parser = argparse.ArgumentParser()

parser.add_argument("fasta_file", help="The fasta file to be processed.", type=str)

args = parser.parse_args()

with open(args.fasta_file, "r") as f:

for line in f.readlines():

line = line.strip()

if line[0] == '>':

name = line.split(">")[1]

print name,

else:

numberOfN = line.count('N')

allChar = len(line)

lowerChars = sum(1 for c in line if c.islower())

Ns_percentage = 100 * (numberOfN/float(allChar))

lower_percentage = 100 * (lowerChars/float(allChar))

waste = Ns_percentage + lower_percentage

print "\t", round(waste) # Note: https://docs.python.org/2/library/functions.html#round

美联储:

^{pr2}$

给出:C:\Python27\python.exe -u "dna.py" fasta.txt

Process started >>>

chr14_Gap_2 29.0

chr14_Gap_3 29.0

<<< Process finished. (Exit code 0)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值