Stop Iteration error when using next()
问题 I am not able to clarify my self over the use of next() in python(3). I have a data : chr pos ms01e_PI ms01e_PG_al ms02g_PI ms02g_PG_al ms03g_PI ms03g_PG_al ms04h_PI ms04h_PG_al 2 15881989 4 C|C 6 A|C 7 C|C 7 C|C 2 15882091 4 A|T 6 A|T 7 T|A 7 A|A 2 15882148 4 T|T 6 T|T 7 T|T 7 T|G and I read it like: Works fine c = csv.DictReader(io.StringIO(data), dialect=csv.excel_tab) print(c) print(list(c)) Works fine c = csv.DictReader(io.StringIO(data), dialect=csv.excel_tab) print(c) keys = next(c)