Re: [Tutor] How to split something?

2012-01-28 Thread Steven D'Aprano
Alan Ting wrote: Hello, How do I get the characters to separate? This is what I did. def personalNote(name): 'Print a personalized love note' x = (name) Oh, I forgot to mention... the line x = (name) is utterly pointless. Instead of wasting time with x=name, just use name everywhere yo

Re: [Tutor] How to split something?

2012-01-28 Thread Steven D'Aprano
Alan Ting wrote: Hello, How do I get the characters to separate? It isn't clear what you mean. Do you mean this? "JOON" => "J O O N" If so: ' '.join('JOON') will do it. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change

[Tutor] How to split something?

2012-01-28 Thread Alan Ting
Hello, How do I get the characters to separate? This is what I did. def personalNote(name):     'Print a personalized love note'     x = (name)     print (x + ", I love you so.")     print ("You brighten my day.")     print ("Oh, " + x + "!")     print ("I wish you could be with me always") Write

Re: [Tutor] how to convert usec/pass to seconds

2012-01-28 Thread Steven D'Aprano
Surya K wrote: I am actually using a activestate wrapper for calculating execution time of my program. [...] I tested it for a puzzle and that showed me around 1385.33 usec/sec..However, as its from facebook hackers cup where I got a penalty time of 28.32.00 (not exactly, forgot).. what units

Re: [Tutor] compile time calculator

2012-01-28 Thread Evert Rol
> Well, using python documentation, I did this.. > > (calculating execution time). > > def main(): > ## This is my whole puzzle code... > > > fobj_ip = open('D:/code/py/input.txt', 'r') > fobj_op = open('D:/code/py/output.txt','w') > > line=1 > for eachLine in fobj_ip: >

[Tutor] how to convert usec/pass to seconds

2012-01-28 Thread Surya K
I am actually using a activestate wrapper for calculating execution time of my program. This is the code #!/usr/bin/python# A simple wrapper for the timeit module.import timeit def Timeit(func,number=1,module="__main__"):""" A wrapper which can be used to time any function """ n

Re: [Tutor] compile time calculator

2012-01-28 Thread Surya K
Date: Fri, 27 Jan 2012 17:35:39 -0800 Subject: Re: [Tutor] compile time calculator From: marc.tompk...@gmail.com To: sur...@live.com CC: tutor@python.org On Fri, Jan 27, 2012 at 7:46 AM, Surya K wrote: Hi, I want to calculate compile time for my puzzles. Since nobody else has mentioned i

[Tutor] Python with HTML

2012-01-28 Thread t4 techno
hi everyone, I want to make a web page which has to include some python script and html tags as well, am not getting how to do that . I searched some articles but cant understand them . is there anything like linking an external html file into python script ? Can u please help for same waiting fo

Re: [Tutor] Rounding Error

2012-01-28 Thread Alan Gauld
On 28/01/12 05:55, Michael Lewis wrote: I am trying to round a float to two decimals, but I am getting the following error: Traceback (most recent call last): File "", line 1, in PaintingProject() File "C:/Python27/Homework/Labs/Lab 03_5.py", line 42, in PaintingProject print 'T