Cheatsheet: Difference between revisions
→Python
(→Python) |
(→Python) |
||
Line 966:
* Class
* OS Interaction:
import os
os.system("date")
import os
f = os.popen('date')
now = f.read()
print("Today is ", now)
import subprocess
subprocess.call(["ls", "-l", "/etc/resolv.conf"])
import subprocess
p = subprocess.Popen("date", stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
print("Today is", output)
|