Re: [Tutor] html and python

2010-02-11 Thread Григор
I found this. http://karrigell.sourceforge.net/en/pythoninsidehtml.htm 2010/2/11 Benno Lang : > On Thu, Feb 11, 2010 at 5:26 AM, Grigor Kolev wrote: >> I apologize to my question is incorrectly set. >> We have a mail list and we want to do in site a list of all participants >> with their photos a

Re: [Tutor] string to list

2010-02-11 Thread Alan Gauld
"Owain Clarke" wrote I would love a really clear explanation of lambda! lambda returns an anonymous function - a function without a name. When we define a function normally we use something like: def square(x): return x*x That creates a function that has the name square We can do the

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Alan Gauld
"Harya Dananjaya" wrote Do you mean a windows executable? Not really. Why do you want an .exe anyway? Python code is (usually) cross-platform. Yupe, python is cross platform, but we need install python in every computer we want to using the pyththon *.py . What would you do with Java? It

Re: [Tutor] "Error :Attempt to overwrite cell" while using xlwt to create excel sheets

2010-02-11 Thread nikunj badjatya
Hi, Many thanks to all.. I tried cell_overwrite=True and its working fine..!! On Wed, Feb 10, 2010 at 6:13 PM, Kent Johnson wrote: > On Wed, Feb 10, 2010 at 6:47 AM, nikunj badjatya > wrote: > > > I commented out the "raise Exception" statement in Row.py library > > module. > > Here's the (lin

Re: [Tutor] string to list

2010-02-11 Thread Alan Plum
On Mi, 2010-02-10 at 16:57 +, Owain Clarke wrote: > I would love a really clear explanation of lambda! Generally, lambdas are anonymous functions. In Python specifically, however, they are limited to simple expressions (i.e. only what you can put on the right-hand side of an assignment). my

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Timo
On 10-02-10 20:40, Harya Dananjaya wrote: Can I compile my python source to exe in ubuntu? Like said before, you need Windows for this. if I can do it, which compiler can do it? I use py2exe to compile my Python/PyGTK application. I build it on my Windows XP machine and it works on Windows 20

Re: [Tutor] string to list

2010-02-11 Thread Stefan Behnel
Owain Clarke, 10.02.2010 17:57: > data.sort(key=lambda x:x[0]) > data.sort(key=lambda x:x[1]) Two things to note: 1) you can use the operator module, specifically operator.itemgetter 2) given that you have lists as items in the 'data' list, it's enough to call sort() once, as the comparison of l

[Tutor] Simple Stats on Apache Logs

2010-02-11 Thread Lao Mao
Hi, I have 3 servers which generate about 2G of webserver logfiles in a day. These are available on my machine over NFS. I would like to draw up some stats which shows, for a given keyword, how many times it appears in the logs, per hour, over the previous week. So the behavior might be: $ ./we

Re: [Tutor] Simple Stats on Apache Logs

2010-02-11 Thread Christian Witts
Lao Mao wrote: Hi, I have 3 servers which generate about 2G of webserver logfiles in a day. These are available on my machine over NFS. I would like to draw up some stats which shows, for a given keyword, how many times it appears in the logs, per hour, over the previous week. So the beha

Re: [Tutor] Simple Stats on Apache Logs

2010-02-11 Thread Lao Mao
Hi Christian, grep -c > or if you are looking for only stuff for today for eg then > grep | grep -c > I don't see how that will produce figures per hour! That would be the simplest implementation. For a python implementation > think about dictionaries with multiple layers like {Date: {Keyw

Re: [Tutor] Simple Stats on Apache Logs

2010-02-11 Thread spir
On Thu, 11 Feb 2010 09:56:51 + Lao Mao wrote: > Hi, > > I have 3 servers which generate about 2G of webserver logfiles in a day. > These are available on my machine over NFS. > > I would like to draw up some stats which shows, for a given keyword, how > many times it appears in the logs, pe

Re: [Tutor] Exiting a Tkinter Program-- An Anomaly or two

2010-02-11 Thread Wayne Watson
Well, I found where I had tucked away my inbox mail folder for tkinter. Somehow it got to be a subfolder of another list. It hadn't been used by me for months. The short of this is that I posted to tkinter, and have a better understanding of this now. In fact, fixed it by using sys.exit() in th

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Harya Dananjaya
On 11/02/10 17:34, Alan Gauld wrote: What would you do with Java? It too is cross platform but requires a JVM to be installed on every platform. Python is similar. OK, but python need 3rd praties library, and may be the the user don't know about the 3rd party libraries, and don't know how to

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Andreas Kostyrka
Am Donnerstag, 11. Februar 2010 12:44:48 schrieb Harya Dananjaya: > On 11/02/10 17:34, Alan Gauld wrote: > > What would you do with Java? It too is cross platform but requires a > > JVM to be installed on every platform. Python is similar. > > OK, but python need 3rd praties library, and may be th

Re: [Tutor] html and python

2010-02-11 Thread Kent Johnson
2010/2/11 Григор : > I found this. > http://karrigell.sourceforge.net/en/pythoninsidehtml.htm Many options here: http://wiki.python.org/moin/Templating Kent ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://ma

Re: [Tutor] string to list

2010-02-11 Thread Kent Johnson
On Thu, Feb 11, 2010 at 4:44 AM, Stefan Behnel wrote: > 2) given that you have lists as items in the 'data' list, it's enough to > call sort() once, as the comparison of lists is defined as the comparison > of each item to the corresponding item of the other list. If you want to > sort based on t

Re: [Tutor] Simple Stats on Apache Logs

2010-02-11 Thread Kent Johnson
On Thu, Feb 11, 2010 at 4:56 AM, Lao Mao wrote: > Hi, > > I have 3 servers which generate about 2G of webserver logfiles in a day. > These are available on my machine over NFS. > > I would like to draw up some stats which shows, for a given keyword, how > many times it appears in the logs, per hou

Re: [Tutor] string to list

2010-02-11 Thread Stefan Behnel
Kent Johnson, 11.02.2010 14:16: > On Thu, Feb 11, 2010 at 4:44 AM, Stefan Behnel wrote: > >> 2) given that you have lists as items in the 'data' list, it's enough to >> call sort() once, as the comparison of lists is defined as the comparison >> of each item to the corresponding item of the other

Re: [Tutor] string to list

2010-02-11 Thread Kent Johnson
On Thu, Feb 11, 2010 at 8:37 AM, Stefan Behnel wrote: > Kent Johnson, 11.02.2010 14:16: >> On Thu, Feb 11, 2010 at 4:44 AM, Stefan Behnel wrote: >> >>> 2) given that you have lists as items in the 'data' list, it's enough to >>> call sort() once, as the comparison of lists is defined as the compar

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Harya Dananjaya
On 11/02/10 17:47, Timo wrote: I use py2exe to compile my Python/PyGTK application. I build it on my Windows XP machine and it works on Windows 2000 to Windows 7 without installing anything else (like Python). Try GUI2exe for a nice graphical interface. Cheers, Timo Yupe, I have a windows,

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Andreas Kostyrka
Am Donnerstag, 11. Februar 2010 15:42:31 schrieb Harya Dananjaya: > On 11/02/10 17:47, Timo wrote: > > I use py2exe to compile my Python/PyGTK application. > > I build it on my Windows XP machine and it works on Windows 2000 to > > Windows 7 without installing anything else (like Python). > > > > T

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Harya Dananjaya
On 11/02/10 23:57, Andreas Kostyrka wrote: What's so hard? It's a plain text error message. thank you,,, Now it's solved, I have include the needed library,,, It's solved, Thank you for all help me, Harya Dananjaya ___ Tutor maillist - Tutor@pyt

[Tutor] Shelve

2010-02-11 Thread Randy Raymond
I am running Python 2.6.4 under Windows Vista 32-bit Home Edition. When I run: import shelve test=shelve.open("myTest.fil") I get a DCPermissionerror exception. I am an administrator on this machine (it is my home PC). Python and Pythonw are both allowed exceptions to the Windows firewall.

[Tutor] Downloading S3 Logs

2010-02-11 Thread Lao Mao
Hello, I've written the below to get the previous day's logs from an Amazon S3 bucket. #!/usr/bin/python import time from datetime import datetime import boto daily_s3_log = open("/tmp/s3logs", "w+") now = datetime.now() connection = boto.connect_s3() bucket = connection.get_bucket("downloads.se

Re: [Tutor] Downloading S3 Logs

2010-02-11 Thread Randy Raymond
Mr. Mao, I am not a professional programmer. However, I do think that you want to reduce the number of "things" that you have to do in loops that go through the transaction (log entries in your case). Since you are converting to a datetime, perhaps rather than doing a calculation, you should r

Re: [Tutor] Downloading S3 Logs

2010-02-11 Thread Tino Dai
On Thu, Feb 11, 2010 at 11:23 AM, Lao Mao wrote: > Hello, > > I've written the below to get the previous day's logs from an Amazon S3 > bucket. > > #!/usr/bin/python > import time > from datetime import datetime > import boto > > daily_s3_log = open("/tmp/s3logs", "w+") > now = datetime.now() > c

Re: [Tutor] Shelve

2010-02-11 Thread Sander Sweers
On do, 2010-02-11 at 10:09 -0600, Randy Raymond wrote: > I am running Python 2.6.4 under Windows Vista 32-bit Home Edition. > When I run: > > import shelve > test=shelve.open("myTest.fil") And to shich directory does this file get written? I suspect you are writing to a protected directory. When

Re: [Tutor] Shelve

2010-02-11 Thread Randy Raymond
Ok, I see that is was the directory restriction that was the problem. Sorry for the simple question. Randy Raymond From: Randy Raymond Sent: Thursday, February 11, 2010 10:09 AM To: Tutor Python Subject: [Tutor] Shelve I am running Python 2.6.4 under Windows Vista 32-bit Home Edition. Whe

[Tutor] Algorithm for combination analysis suggestion.

2010-02-11 Thread Matthew Matson
Hi Tutors, I am looking for the proper approach regarding the analysis of a dictionary of combinations I have. What I need to do is read from a supplied text file that has a unique ID and that unique ID's associated combination of elements. So let's say I have the following lines in a text

[Tutor] SMTP

2010-02-11 Thread Grigor Kolev
Hi. I try send a mail with smtplib Server work with postfix. I try it import smtplib s=smtplib.SMTP("localhost") tolist=['grigor.ko...@gmail.com'] msg = '''\ From: grigor.ko...@gmail.com Subject: testin' This is a test ''' s.sendmail("t...@local"

Re: [Tutor] Algorithm for combination analysis suggestion.

2010-02-11 Thread Kent Johnson
On Thu, Feb 11, 2010 at 1:59 PM, Matthew Matson wrote: > > Hi Tutors, > > I am looking for the proper approach regarding the analysis of a dictionary > of combinations I have. > > What I need to do is read from a supplied text file that has a unique ID and > that unique ID's associated combination

Re: [Tutor] SMTP

2010-02-11 Thread Kent Johnson
On Thu, Feb 11, 2010 at 3:13 PM, Grigor Kolev wrote: > Hi. > I try send a mail with smtplib > Server work with postfix. > I try it > >  import smtplib >  s=smtplib.SMTP("localhost") > tolist=['grigor.ko...@gmail.com'] > msg = '''\ >  From: grigor.ko

Re: [Tutor] Compile py to exe in ubuntu

2010-02-11 Thread Alan Gauld
"Harya Dananjaya" wrote What would you do with Java? It too is cross platform but requires a JVM to be installed on every platform. Python is similar. OK, but python need 3rd praties library, No, you can write very sophisticated Python apps using just the standard library. Equally many Ja

Re: [Tutor] SMTP

2010-02-11 Thread Alan Gauld
"Grigor Kolev" wrote I try send a mail with smtplib Server work with postfix. I try it import smtplib s=smtplib.SMTP("localhost") This requires you to have an SMTP server running on localhost. Do you? I notice you say the server works with p

Re: [Tutor] Algorithm for combination analysis suggestion.

2010-02-11 Thread Matthew Matson
Thanks Kent. I know this is confusing, perhaps if we look at it this way. Let's say A,B,C,D,E are widgets that I manufacture, now the easiest way for me to distribute them to the the unique IDs would be to gather all the widget quantities from the complete list of combinations. In this case I

[Tutor] Coin flip game

2010-02-11 Thread Jones, Lawrence D
Hi, I'm new to the list and to Python. I'm reading through Michael Dawson's 'Python programming: for absolute beginners' and at the end of chapter 3 he's set a challenge where the reader has to create a coin flip game. My code now works, but only after I randomly switched pieces of the code aro

Re: [Tutor] Coin flip game

2010-02-11 Thread Benno Lang
On Fri, Feb 12, 2010 at 7:15 AM, Jones, Lawrence D wrote: > My code is below. But can someone please explain to me why the following > variable has to be placed where it is for the code to work? I thought it > would need to go nearer the start of the code i.e. just before heads = 0, > tails = 0 et

Re: [Tutor] Coin flip game

2010-02-11 Thread David
Hello Lawrence, let me try to clarify this (warning: am a beginner myself). On 12/02/10 06:15, Jones, Lawrence D wrote: Hi, I'm new to the list and to Python. I'm reading through Michael Dawson's 'Python programming: for absolute beginners' and at the end of chapter 3 he's set a challenge wh

Re: [Tutor] Coin flip game

2010-02-11 Thread Alan Gauld
"Jones, Lawrence D" wrote My code is below. But can someone please explain to me why the following variable has to be placed where it is Others have explained about variable creation and the fact you need to be inside the loop to get different results for each iteration.

Re: [Tutor] Simple Stats on Apache Logs

2010-02-11 Thread Justin Lintz
On Thu, Feb 11, 2010 at 4:56 AM, Lao Mao wrote: > Hi, > > I have 3 servers which generate about 2G of webserver logfiles in a day. > These are available on my machine over NFS. > > I would like to draw up some stats which shows, for a given keyword, how > many times it appears in the logs, per hou