def readtextdata(nam): f = open(nam) aa = f.read() aa = aa.replace("\n", " ") aa = aa.split(" ") aa = [int(item) for item in aa] return aa