Re: [Tutor] Help: wget-- how does it work?

2005-05-28 Thread Kent Johnson
Aaron Elbaz wrote: > One of my favourite unix applications is wget. > > Thinking how easy (and fun) it might be to implement with pythons > excellent librairies has led me to a few questions. > > First, I found the progress bar class from aspn > http://aspn.activestate.com/ASPN/Cookbook/Python/Re

Re: [Tutor] Help: wget-- how does it work?

2005-05-28 Thread Terry Carroll
On Fri, 27 May 2005, Terry Carroll wrote: > I use this for an app I have that reads the 27-meg Unihan.txt file; but I > think I cheat and hardcode the 27-meg no. I just checked, and, yep, that's exactly what I do. ___ Tutor maillist - Tutor@python.o

Re: [Tutor] UTF-8 by default

2005-05-28 Thread Kent Johnson
Jonas Melian wrote: > Hi all, > > I'm working with an XML file, and i want to write in UTF-8 > How write by default in UTF-8 instead of ASCII? How are you writing the file? What encoding is your data originally? If the data is all in US-ASCII (codes 0-127) then it is already UTF-8 as US-ASCII i

[Tutor] oops!

2005-05-28 Thread Tom Cloyd
Sorry about that last post! I thought I was replying to a Komodo list post. -- t. == Tom Cloyd Bellingham, Washington, U.S.A: (360) 920-1226 << BestMindHealth.com >> == Using Opera's revolutio

[Tutor] UTF-8 by default

2005-05-28 Thread Jonas Melian
Hi all, I'm working with an XML file, and i want to write in UTF-8 How write by default in UTF-8 instead of ASCII? And I want not to use: print u'String' Thanks in advance! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo

Re: [Tutor] reading comments

2005-05-28 Thread Terry Carroll
On Sat, 28 May 2005, Servando Garcia wrote: > How do I read the comments attached to a zipfile or for > any file .? Someone's on riddle 6! :-) z = zipfile.ZipFile(zipfilename, mode='r') zi = z.getinfo(zfilename) print zi.comment __

Re: [Tutor] increment operator

2005-05-28 Thread Terry Carroll
On Fri, 27 May 2005, Lee Cullens wrote: > I find the following invaluable - maybe you will also. > > http://rgruet.free.fr/PQR24/PQR2.4.html That's a great resource. Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listin

[Tutor] check PID

2005-05-28 Thread Alberto Troiano
Hey all I want to check if a PID number is running I have the pid number from other program and I want to check if it's alive Using Python 2.2 over Linux Red Hat 9 I tried to google but find how to know process of the app but not check for other pids Thanks ina dvanced Alberto __

Re: [Tutor] reading comments

2005-05-28 Thread Kent Johnson
Servando Garcia wrote: > Hello list > How do I read the comments attached to a zipfile or for any > file .? For a zipfile, you can open the file with the zipfile module. Each file in the zip has a ZipInfo object associated with it. You get a single ZipInfo using getinfo(name) on t

[Tutor] reading comments

2005-05-28 Thread Servando Garcia
Hello list How do I read the comments attached to a zipfile or for any file .? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] a generic table data structure for table / 2d array / lookup table?

2005-05-28 Thread Pujo Aji
You can create small class with handle table thing and use dictionary as the main data. Look at this code: class mytable: def __init__(self): self.dat = {} pass def input(self,row,col,val): self.dat[row] = {col:val} pass def output(self,row,col): try: return self.dat[row]

Re: [Tutor] a generic table data structure for table / 2d array / lookup table?

2005-05-28 Thread Kent Johnson
Marcus Goldfish wrote: > Before I try to reinvent the wheel, can anyone point me to a data > structure suitable for storing non-numeric, 2-d arrays. For instance, > something that can store the following: > > A B C D > 1 'cat' 3object 9 > J4 [1] 5

Re: [Tutor] (no subject). Ord and Chr query

2005-05-28 Thread John Carmona
Hi Ben, you wrote --- John Carmona <[EMAIL PROTECTED]> wrote: >Ben I could not get your script working indentation? You were right, it is working now, thanks JC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] increment operator

2005-05-28 Thread Alan G
> Is there a increment operator in python similar to c++ > like so "SomeVariable++" No. There is the shorthand += assignment but no ++ So x += 1 is the closest thing to x++ HTH, Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.or

Re: [Tutor] Formatted writing to a file

2005-05-28 Thread Alan G
> >Just create the string outsoide the formatting line: > > > >fmtString = '%%ds' % width > > I think it should be '%%%ds' % width Good catch Bob, you need the extra % to 'escape' the literal % character. Alan G. ___ Tutor maillist - Tutor@python.org

[Tutor] a generic table data structure for table / 2d array / lookup table?

2005-05-28 Thread Marcus Goldfish
Before I try to reinvent the wheel, can anyone point me to a data structure suitable for storing non-numeric, 2-d arrays. For instance, something that can store the following: A B C D 1 'cat' 3object 9 J4 [1] 56 where the column and row la