file = open("in.txt")
line = file.readline()
line = line.strip()
print(line)
file.close()


with open("in.txt") as file:
    line = file.readline()
    line = line.strip()
    print(line)

with open("in.txt") as file:
    lines = file.readlines()
    print(lines)

with open("in.txt") as file:
    for line in file.readlines():
        print(line.strip())


with open("in_cz.txt", encoding="utf8") as file:
    line = file.readline()
    line = line.strip()
    print(line)


out_file = open("out.txt", "w")
out_file.write("123")
out_file.write("456")
out_file.close()

with open("out.txt", "w", encoding="utf8") as out_file:
    out_file.write("123\r\n")
    out_file.write("456\n")

    print("hello", file=out_file)
    print("hello", file=out_file)
    print("český", file=out_file)
