[python]Threading, acquiring and releasing lock to access shared resource.

On previous post about threading, there is no worry of data corruption as each fetch and write is to different destination and write to different file respectively. What if the requirement is to append all data fetched from multiple websites and write them into a single file? There will be race condition which the same … Continue reading [python]Threading, acquiring and releasing lock to access shared resource.

[python]Threading

This is a revision for myself on threading. To start threading in python a package threading has to be imported. The dictionary for a list of websites, the script is to save the body of the website into a file. For each key in urls, a thread object is created. The thread object takes in … Continue reading [python]Threading

[Go]Capture user’s entered sentence and save into a file.

This extends the previous post about capturing user's input. The captured input is stored into a file known as text.txt. To write a string to a file ioutil.WriteFile is used, this method requires three arguments: filename in string string byte slice, which is the ascii representation of the string slice The permission, if unsure check … Continue reading [Go]Capture user’s entered sentence and save into a file.