1 |
On Thu, Jun 7, 2012 at 2:25 PM, Thanasis <thanasis@××××××××××.org> wrote: |
2 |
> I used to use this python script to display the packages that would be |
3 |
> emerged when using the "--resume" option. But it does't work with |
4 |
> python3.2 interpreter: |
5 |
> |
6 |
> ~ # cat resume_list.py |
7 |
> import portage |
8 |
> |
9 |
> resume_list=portage.mtimedb["resume"]["mergelist"] |
10 |
> |
11 |
> for i in range(len(resume_list)): |
12 |
> print "="+resume_list[i][2] |
13 |
> ~ # |
14 |
> ~ # python ~/resume_list.py |
15 |
> File "/root/resume_list.py", line 6 |
16 |
> print "="+resume_list[i][2] |
17 |
> ^ |
18 |
> SyntaxError: invalid syntax |
19 |
> ~ # |
20 |
> |
21 |
> Q: Is there a way to make it work with python3.2 ? |
22 |
> |
23 |
|
24 |
In Python 3.x, 'print' is a function, not a builtin. So it'd be |
25 |
|
26 |
print( "blah" ) |
27 |
|
28 |
instead of |
29 |
|
30 |
print "blah" |
31 |
|
32 |
There are standard scripts out there for converting between py2 and py3, FWIW. |
33 |
|
34 |
-- |
35 |
:wq |