[anaconda:master 1/2] Make print statement print output w/out surrounding parentheses.

mulhern amulhern at redhat.com
Fri Feb 20 13:36:52 UTC 2015


Previously print statement was:

print dev, size
yielding outtput like: sda 8394.0

it was changed to
print (dev, size)
which was interpreted by Python 2 as a print statement on a tuple, and
displayed accordingly,
('sda', 8394.0)
while Python3 interpreted as a print call on two arguments and displayed
sda 8394.0.

Use a format string, so that Python 3 and Python 2 will display consistantly
with each other and with previous version.

The alternative is to import the print function from the future, but that
seems like more trouble.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 data/command-stubs/list-harddrives-stub | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/command-stubs/list-harddrives-stub b/data/command-stubs/list-harddrives-stub
index 3c52d35..28274e4 100755
--- a/data/command-stubs/list-harddrives-stub
+++ b/data/command-stubs/list-harddrives-stub
@@ -35,7 +35,7 @@ def main(argv):
     lst = list(lst)
     lst.sort()
     for dev, size in lst:
-        print(dev, size)
+        print("%s %s" % (dev, size))
 
 if __name__ == "__main__":
     main(sys.argv)
-- 
1.9.3



More information about the anaconda-patches mailing list