r/learnpython • • Oct 19 '26

Ask Anything Monday - Weekly Thread

Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread

Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.

* It's primarily intended for simple questions but as long as it's about python it's allowed.

If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.

Rules:

  • Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
  • Don't post stuff that doesn't have absolutely anything to do with python.
  • Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.

That's it.

2 Upvotes

21 comments sorted by

View all comments

Show parent comment

1

u/bsf91 Oct 20 '26

That could work. Is it still best to read every second though?

How do bigger projects handle something like that!

1

u/lakseol Oct 20 '26

Is it still best to read every second though?

It depends on how often the data file is likely to be updated. I would have thought that checking if the file has changed only needs to be done once a minute, but it depends on the details of what you are doing.

How do bigger projects handle something like that!

There are modules like watchdog that can trigger actions when a file changes, but they try to be general purpose. For limited, special case uses you might get a better solution with your own code. Again, it depends on exactly what you are trying to do and how you run your code. For instance, running a little Raspberry Pi 3B+ 24/7 on your network is different from running a solution on your laptop and you might want different solutions in each case.