Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9257739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:12:28+00:00 2026-06-18T12:12:28+00:00

import struct from collections import namedtuple StructDeviceInfo = namedtuple(‘DeviceInfo’, [‘DeviceID’, ‘Capturing’,’Receiving’,’Socket’,’DateTime’]) DeviceInfoList = []

  • 0
import struct
from collections import namedtuple

StructDeviceInfo = namedtuple('DeviceInfo', ['DeviceID', 'Capturing','Receiving','Socket','DateTime'])
DeviceInfoList = []

def threaded_function():
    while True:
        if any(x.Capturing == True and x.Datetime in DeviceInfoList different second > 5 for x in DeviceInfoList) : #here,how to do on here?
              print('True')

if the DeviceInfoList array inside the Capturing Value is TRUE and at the same time the Datetime are different with datetime.now are more than 5 second. then print true,how to do this?

p/s:the Capturing is TRUE and datetime is more than 5 seconds,must be same array index .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:12:29+00:00Added an answer on June 18, 2026 at 12:12 pm
    delta = datetime.datetime.now() - x.Datetime
    if delta.total_seconds() > 5:
        # difference is greater than 5 seconds 
    

    Applied to your example, assuming that x.Datetime actually is a datetime.datetime object:

    if any((
            x.Capturing == True and 
            (datetime.datetime.now() - x.Datetime).total_seconds() > 5
           ) for x in DeviceInfoList):
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import struct from collections import namedtuple StructPageNum = namedtuple('FDResult', ['DeviceID', 'PageNum','PicSize','PicData']) PageNumList = []
import socketserver import struct from collections import namedtuple class MyUDPHandler(socketserver.BaseRequestHandler): def handle(self): data =
Below Are Struct from C,and i m trying Convert to Python, and use Socket
I have this Python code to do this: from struct import pack as _pack
I am trying to import data from a saved MATLAB struct array, but it
I have the code from struct import pack self.data = {'SYNC' : 0x16, 'SOH'
I have done the following. from struct import pack, unpack t = 1234 tt
The following: >>>import struct >>>struct.unpack('!d', ('40d11998e5035288').decode('hex'))[0] >>> >>>17510.3889778429 I would like to be able
I compress my files using this script import pylzma, struct i = open(path+fileName,'rb') o
import MySQLdb import sys from libdesklets.controls import Control from IDBConnection import IDBConnection class DBConnection(Control,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.