%load_ext withmagic %with open('withmagic.py') as f: print(f.readline()) len(f.readlines()) %endwith