Title: Signature.html
Well, let me try this again. I'm only interested in time. The user sees a widget dialog that asks him to put the time in it in the format HH:MM:YY, so he enters 15:30:10, or, as before 15:00:00. The value gets back to the code I'm working in as 15:30:10 as the type in Subject. I need to write the value to a file as a string, "15:30:10". In fact, I want to write it as start_time=15:30:10 in a txt file.

Ah, this was as simple as using str(time_value), where time_value was of the aforementioned type. That's Kent's [4], and looked tempting for its simplicity. Too simple, I guess for me to try. str() had a little more umph that I thought. I had played around with the datetime module some many months for many combos of date+time, and anticipated having to beat against it again.  Thankfully not here. :-)

Good. Thanks.

wesley chun wrote:
On Fri, Feb 13, 2009 at 3:50 PM, Wayne Watson
<sierra_mtnv...@sbcglobal.net> wrote:
  
That's pretty much the question in Subject. I've got a date time variable
with, for example, 15:00:00 in hh:mm:ss format, and I'd like to make it a string.
    

  
import datetime
d = datetime.time(15,0)
        
datetime.time(15, 0)
  
d
        
datetime.time(15, 0)
  
str(d)
        
'15:00:00'

is this what you're looking for, or was there something else?
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com

  

--
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
            
            Shhhh, quiet. I'm thinking about filling this space. 


                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to