Skip to content

Tag: python-2.7

G++ cannot resolve paths when called from subprocess

I am writing a small python script to for automatic student homework evaluation. I have a skeleton, where submitted homework is unzipped into a temporary folder and my script is called with path to the temporary folder as an argument. My script first copies over some extra files I need and then tries to compi…

Root autentication on a Python program

I have the root password saved in a variable. How I can give the root authorization at my program? This can be an example: Answer It is impossible to do it in the way you try. Your program is already started under some non-root user and you cannot change it inside this program. You can spawn other process whi…

Summing columns in a text file

I have a data file that looks like this: and so on……till TOPIC:topic_2000. The first line is the topic and it’s weight. That is, I have the words in that specific topic and their respective weights. Now, I want to sum up the second column of each topic and check what value it gives. That is,…