I've been trying to find a proper solution to my problem for several days now looking everywhere. Hopefully some of you guys can direct me to the right direction.
I am trying to implement a system with proxy list. Where system is picking up proxy from list, trying to connect using it and if it failed to connect, modify the line of the proxy in proxy.txt with " = 1" means Timed Out one time.
When system will stumble on this proxy again next time and it will fail again, it should modify " = 1" to " = 2" etc. Converting string to int, changing values and then converting back to string is not difficult to do.
My problem here is what I can't find the way how to put cursor to specific proxy and then replace " = Number" value. I can find proxy by using .seek(), but taking into account that every proxy has different length of characters .seek(proxy + 20) simply won't work...
For example, proxy.txt has:
192.168.0.1:8000 = 2
192.168.0.10:80 = 1
192.168.0.100:3128 = 2
192.168.0.4:8080
192.168.0.5:7822 = 2
192.168.0.6:8005
Even if I can find the proxy I need by scanning every line and then fire .seek(address of the proxy), how can I move then to "=" character?
I know if might be much easier just to copy everything from text file to pickle file and then modify everything there by using dictionaries etc. But the idea is that I can open text file at any time and see what proxies are failing.
Thanks.