Re: [Tutor] Copy script

2008-04-09 Thread Anthony Baldwin
Alan Gauld wrote:
 Que Prime [EMAIL PROTECTED] wrote

   
 I have a folder of 150,000 pdf files and I need to copy 20,000 of 
 them to
 another folder.  The ones I need to copy are in a .txt file.
 
Assuming the text file is a list of those to be copied,
wouldn't a simple bash script do the trick?
(don't know about windows, but this would work on Mac or Linux,
and, I assume there must be a way to do this with a  windows command 
line script of some sort.)

#!/bin/bash

cd /path/to/dir/with/files/and/list

llistofiles=$(cat your .txt file here)

echo Copying files...

for each i in $listofiles
do
cp $i /path/to/other/folder/$i

echo All done...b'bye...

exit

Or, perhaps with tcl

#!/usr/bin/wish

set listofiles [read your txt file here]

puts Copying files...

foreach a {$listofiles} {
file copy $a /path/to/target/dir
}

puts All done...b'bye...

exit

I imagine python could do something quite similar,
but confess I am just lurking on this list and have barely begun
to learn python.

/tony

-- 
Anthony Baldwin

http://www.BaldwinLinguas.com 
Translation  Interpreting

http://www.TransProCalc.org 
Free translation project mgmt software 

http://www.LinguasOS.org 
Linux for Translators


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Question about global variables on modules

2008-04-04 Thread Anthony Baldwin
Tiago Katcipis wrote:
 I know its not such a pretty thing to have global variables but its only
 for an exercise my teacher told to do. Its a function to calculate the
 results of a matrix using jacob. I want to inside the module (inside a
 function on the module )assign a value to a global variable, but the
 only way i found to do this inside the own module function is importing
 the module inside himself. Is there another way of doing this? its kind
 odd to import the module to himself, i think  :-) 

 here goes the code
   
Oi, Tiago

Não sei muito bem como funciona em Python,
sendo que já estou começando a aprender-lo, mais,
deve ter algo como o uplevel em Tcl, não?
Tcl's uplevel sets a variável pelo namespace global.
Ou talvez algo como
set ::var value (esse funciona em tcl
pra set a variável globalmente mas dentro de um proc)?

/tony

-- 
Anthony Baldwin

http://www.BaldwinLinguas.com 
Translation  Interpreting

http://www.TransProCalc.org 
Free translation project mgmt software 

http://www.LinguasOS.org 
Linux for Translators


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Which Python Script Editor of Choice?

2008-04-03 Thread Anthony Baldwin
Andreas Kostyrka wrote:
 Eric and SPE are also nice.

 The good thing here is that the majority of IDEs for Python are free.

 Andreas

 Am Donnerstag, den 03.04.2008, 16:57 +0100 schrieb Alan Gauld:
   
 Jeffrey Dates [EMAIL PROTECTED] wrote

 
 So as I'm starting to get into writing some scripts, I'm looking for
 recommendations for a nifty script editor.  Ideally a 
 freeware/shareware
 solution until I can justify a purchase of something more beefy.
   
 editor choice is a sensitive topic for programmers and
 tends to lead to religious wars.


 

I use TickleText (http://sourceforge.net/projects/tickletext/ )
It doesn't have python syntax highlighting though.
I'm really just starting with python, and mostly hack tcl.tk,
in which TickleText is written.
It's good for writing html and LaTeX, and other stuff, too, and has
some other useful features.
It's certainly not as fat and bloated as Emacs (hehe...Emacs is cool, 
really).
I used to use medit or kate.
But then I made Tickle Text.
Kdevelop is nice if you want a full IDE that does recognize python syntax.
And, of course, if you are using Linux.  I don't use KDE (use fluxbox), but
I like some of these KDE tools.

/tony

-- 
Anthony Baldwin

http://www.BaldwinLinguas.com 
Translation  Interpreting

http://www.TransProCalc.org 
Free translation project mgmt software 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor