I currently have some code that goes to a URL, fetches the source code, and I’m trying to get it to return a variable from the string. So I created:
changetime = refreshsource.find(‘VARIABLE pm NST’)
But it wouldn’t find the area in the string because the word is not VARIABLE, it is something else. How would I retrieve the constantly changing VARIABLE from that string?
A regular expression will be able to achieve this for you. I’d you give some examples of what variable will be the we could come up with a strict expression. To match what you have above something like the following will do:
Edit: this code will actually work (unlike that first attempt 🙂 ):