cat file1.txt
python3 people.py Gosho Pesho Tosho Arguments: 4 Arg 1: people.py Arg 2: Gosho Arg 3: Pesho Arg 4: Tosho
The sys library
>>> path = os.getcwd() >>> for entry in os.scandir(path): ... if not entry.name.startswith('.') and entry.is_file(): ... print(entry.name)
https://docs.python.org/3/library/os.html
>>> f = open("foo.py", "r") >>> f.read() 'def a(): pass' >>> f.close() >>> f = open("foo.py", "r") >>> f.readlines() ['def a(): pass']
with open("foo.py", "w") as f: ... f.write("def a(): pass")
with open("foo.py", "a") as f: ... f.write("print(a())")
if __name__ == "__main__": print("In {0} module".format(__name__))
By Hack Bulgaria
github.com/HackBulgaria