(c) 2023 Technische Hochschule Augsburg - Fakultät für Informatik - Prof.Dr.Nik Klever - Impressum
import os
os.getcwd()
'/home/student/SE2016FS02/Videos/Standard Bibliothek 1'
os.chdir("..")
os.getcwd()
'/home/student/SE2016FS02/Videos'
os.chdir("Standard Bibliothek 1")
os.mkdir("Test")
os.chdir("Test")
os.getcwd()
'/home/student/SE2016FS02/Videos/Standard Bibliothek 1/Test'
os.chdir("..")
os.system("rmdir Test")
0
os.mkdir("Test")
os.rmdir("Test")
os.mkdir("Test")
with open("Test/Test.txt","w") as f:
f.write("Test")
os.rmdir("Test")
--------------------------------------------------------------------------- OSError Traceback (most recent call last) <ipython-input-14-dcfb8f1c3f30> in <module>() ----> 1 os.rmdir("Test") OSError: [Errno 39] Directory not empty: 'Test'
!rmdir Test
rmdir: konnte 'Test' nicht entfernen: Das Verzeichnis ist nicht leer
os.remove("Test/Test.txt")
os.rmdir("Test")
import shutil
shutil.copyfile("Betriebssystem Werkzeuge.ipynb", "Test.ipynb")
'Test.ipynb'
os.mkdir("Test")
shutil.move("Test.ipynb", "Test/")
'Test/Test.ipynb'
import glob
glob.glob("*.ipynb")
['Betriebssystem Werkzeuge.ipynb']
glob.glob("*/*.ipynb")
['Test/Test.ipynb']
glob.glob("**/*.ipynb",recursive=True)
['Betriebssystem Werkzeuge.ipynb', 'Test/Test.ipynb']
%%writefile test.py
import sys
print(sys.argv)
Writing test.py
!python test.py eins 1 zwei 2 drei 3
['test.py', 'eins', '1', 'zwei', '2', 'drei', '3']
import sys
sys.path
['', '/home/student/anaconda3/lib/python35.zip', '/home/student/anaconda3/lib/python3.5', '/home/student/anaconda3/lib/python3.5/plat-linux', '/home/student/anaconda3/lib/python3.5/lib-dynload', '/home/student/anaconda3/lib/python3.5/site-packages', '/home/student/anaconda3/lib/python3.5/site-packages/Sphinx-1.4.1-py3.5.egg', '/home/student/anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg', '/home/student/anaconda3/lib/python3.5/site-packages/IPython/extensions', '/home/student/.ipython']
sys.stdout.write("Dies schreibe ich auf die normale Standardausgabe")
Dies schreibe ich auf die normale Standardausgabe
sys.stderr.write("Dies schreibe ich auf die Standard-Error-Ausgabe")
Dies schreibe ich auf die Standard-Error-Ausgabe
input("Bitte geben sie eine Integer Zahl ein: ")
Bitte geben sie eine Integer Zahl ein: 13
'13'