Passing values from bash to python
Question: I am trying to implement bash with python can anybody help me or teach me on
what should be done.Thanks my code is

    
    
    import io
    
    val=os.system("echo 'sdfsfs'") #for example
    
    print(val)
    


Answer: 
    >>> import subprocess
    >>> subprocess.chec
    subprocess.check_call    subprocess.check_output  
    >>> val = subprocess.check_output(['echo', "'sdfsfs'"])
    >>> print(val)
    'sdfsfs'
    

If you have ipython, you can also do this with a shell escape:

    
    
    In [1]: val = !echo 'sdfsf'
    
    In [2]: val
    Out[2]: ['sdfsf']
    

