I am redirecting my prints from a python script to a new file with this:
sys.stdout= open('/home/miriam/Dokumente/Atom/python/results.txt',"w")
instead of "results.txt", I want to name the file using a variable I read from stdin. What I want is something like:
var=sys.argv[1]
sys.stdout= open('/home/miriam/Dokumente/Atom/python/var_results.txt',"w")
Is there a way to do this? I tried it with escaping with backslashes, but couldnt figure it out
This might be a duplicate, but I could not find anything so far. Thanks in advance :)