Gentoo Archives: gentoo-user

From: Thanasis <thanasis@××××××××××.org>
To: gentoo-user@l.g.o
Cc: Paul Hartman <paul.hartman+gentoo@×××××.com>
Subject: SOLVED [gentoo-user] resume_list.py
Date: Thu, 07 Jun 2012 19:05:22
Message-Id: 4FD0FAC5.9010106@asyr.hopto.org
In Reply to: Re: [gentoo-user] resume_list.py by Paul Hartman
1 on 06/07/2012 09:37 PM Paul Hartman wrote the following:
2 > On Thu, Jun 7, 2012 at 1:25 PM, Thanasis <thanasis@××××××××××.org> wrote:
3 >> I used to use this python script to display the packages that would be
4 >> emerged when using the "--resume" option. But it does't work with
5 >> python3.2 interpreter:
6 >>
7 >> ~ # cat resume_list.py
8 >> import portage
9 >>
10 >> resume_list=portage.mtimedb["resume"]["mergelist"]
11 >>
12 >> for i in range(len(resume_list)):
13 >> print "="+resume_list[i][2]
14 >> ~ #
15 >> ~ # python ~/resume_list.py
16 >> File "/root/resume_list.py", line 6
17 >> print "="+resume_list[i][2]
18 >> ^
19 >> SyntaxError: invalid syntax
20 >> ~ #
21 >>
22 >> Q: Is there a way to make it work with python3.2 ?
23 >>
24 >
25 > I believe parentheses are mandatory for print function in python 3.x.
26 > So try to change it to:
27 > print("="+resume_list[i][2])
28 >
29 > Disclaimer: I do not know python. :)
30 >
31
32
33 That was it!
34 Thanks!