I want to creat file with each line having date + time + data so I can append more data as need be and know when it was added. What date+time function would be best?
I just was messing around with the time module tonight. are you asking for something simple like
>>> import time >>> time.ctime() 'Mon Oct 24 23:30:47 2005'
That would do it - but maybe a little shorter is even better.
how about this
import time # time.localtime() splits the time into elements of a tuple tuple_time = time.localtime() # don't europeans do day/month/year ? time_stamp = "%s:%s %s/%s/%s" %(tuple_time, tuple_time, tuple_time, tuple_time, tuple_time) print time_stamp
edit added later//
I noticed a time like one minute after 12 looks like this
that could be fixed with a little more code
this code fixes that issue
def time_stamp(): import time tuple_time = time.localtime() hours = tuple_time if int(hours) in range(10): hours = "0%s" %hours minutes = tuple_time if int(minutes) in range(10): minutes = "0%s" %minutes day = tuple_time month = tuple_time year = tuple_time # don't europeans do day/month/year ? time_ = "%s:%s %s/%s/%s" %(hours, minutes, day, month, year) return time_
That looks good. Many countries in Europe have day/month/year format, but that doesn't make much sense for what I may want to do. I am thinking about a date and time stamp starting each data line where the line could be sorted. It could have to look something like year/month/day hour:minute:second to do this rightly.
The tuple_time almost has this sorting format.
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...