If you are wrapping shell commands with Python modules you might see this error a number of times . This usually happens when you grep some output from a command and assign it to a variable and then you will need to use that variable in another command . So there will be a...
Python allows you to run shell commands which you can use in your automation tasks and manage to start other serverside programs . Some of the useful python modules to execute shell commands are : You can immedeatley execute a shell command with the os.system command os.popen module opens a pipe from command prompt...
Sonetimes you need to run shell commands in your Python script, there are few different modules in python for that and the subprocess is one of those . Then you might need to copy the output of your shell command to a log file . This can be usually done with the append (>>)...
This small python script will compare the two files : file1 and file2 and write the difference to a file diff.txt
Sometimes you may need to sort the order of your items in a dictionary which is not possible by default . In this case you need to convert your dict to a list of Tuples . First you need a module called operator which comes with Python3 or you can install it with ‘pip’...