You can try to use os module to deal with these direct commands.