Print new line not working in Python -
the \n doesn't seem work me when use print. using python 2.7.8. don't whats wrong, think \n print should print new line straight forwardly.
import sys import os import subprocess collections import ordereddict import xmlrpclib import hawkey op_name = sys.argv[1] pkg_name = sys.argv[2] # hawkey configurations sack = hawkey.sack() path = "/home/thejdeep/test_repo/repodata/%s" repo = hawkey.repo("test") repo.repomd_fn = path % "repomd.xml" repo.primary_fn = path % "b6f6911f7d9fb63f001388f1ecd0766cec060c1d04c703c6a74969eadc24ec97-primary.xml.gz" repo.filelists_fn = path % "df5897ed6d3f87f2be4432543edf2f58996e5c9e6a7acee054f9dbfe513df4da-filelists.xml.gz" sack.load_repo(repo,load_filelists=true) # main function if __name__ == "__main__": print "querying repository\n" print "-----------------------\n" print "found packages :\n" print "--------------\n" q = hawkey.query(sack) q = q.filter(name=pkg_name,latest_per_arch=true)[0] if q: pkg in q: print str(pkg) else: print "no packages name "+pkg_name+" found. exiting" sys.exit() print "--------------------" print "performing dependency check"
output this. printing in same line :
querying repository ----------------------- found packages : --------------
using print method automatically add \n @ end of line not necessary put \n @ end of each line.
Comments
Post a Comment