2016-03-31 4 views
0

の分があるかどうかを確認するためにtime.struct_timeオブジェクトをチェックしたいと思っています。time.struct_timeオブジェクトから分をチェックする

私はこれ試してみてください。それは私がif epg_time_3の文を渡す取得することはできません

time.struct_time(tm_year=1900, tm_mon=1, tm_mday=1, tm_hour=17, tm_min=30, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1) 

epg_time_3ため

one_hour_half = str(self.getControl(346).getLabel()) 
epg_time_3 = time.strptime(one_hour_half, '%I:%M%p') 
program_stop_time = time.strptime(prog_stop_clock, '%I:%M%p') 


if program_stop_time > epg_time_3: 
    if int(current_time) >= 30 and int(current_time) >= 59: 
     if epg_time_3 == '30': 
      print "you are here, now let do something..." 

結果を。私はtime.struct_timeを使用しているので、変数one_hour_halfを使用しています。これは5:30PMという文字列を表示しています。私はどのように私は分30を持っているかどうかを確認するためにtime.struct_timeオブジェクトepg_time_3を使用することができますか?

答えて

0

わずか数分のフィールドを取得するためにepg_time_3.tm_minを使用します。

if epg_time_3.tm_min == 30: 
    print "you are here, now let do something..." 
関連する問題