[Tutor] Iterating through a list of strings

Walter Prins wprins at gmail.com
Thu May 6 01:06:50 CEST 2010


On 03/05/10 06:16, Thomas C. Hicks wrote:
> I am using Python 2.6.4 in Ubuntu.  Since I use Ubuntu (with its every
> 6 months updates) and want to learn Python I have been working on a
> post-install script that would get my Ubuntu system up and running with
> my favorite packages quickly.

As an aside, you don't particularly need to write a Python script for 
what you want from scratch, you could look at this script named 
"dpkg-origins" which is also written in Python and is related to what 
you want (it helps dump all installed packages on an existing system): 
http://goonmill.org/static/dpkg-origins

It basically allows you to do this...:

|dpkg-origins > selections.txt|

... which produces a file listing all the packages installed on a 
system.  Obviously you can edit this file manually if you so choose.

Then, you can use the file on a freshly installed machine to reinstall 
all the packages using this pipeline command (here you don't need Python 
or a script as such):

| cat selections.txt | sudo dpkg --set-selections && sudo apt-get -u 
dselect-upgrade |

Not meaning to spoil your fun, but just thought I'd point all that out...

Regards

Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100506/f893c5ae/attachment.html>


More information about the Tutor mailing list