这份数据有几列几行
下面是这条路线贯穿使用的销售记录。运行程序,看它数出几列、几条记录(不含表头):
SALES = ("date,store,item,qty,price\n2026-09-01,东门,包子,10,2\n2026-09-01,东门,豆浆, 8 ,3\n2026-09-01,西门,油条,,2.5\n2026-09-01,西门,包子,10,2\n2026-09-01,东门,包子,10,2\n2026-09-02,北门,豆浆,five,3\n2026-09-02,北门,油条,4,2.5\n2026-09-02,西门,豆浆,6,3\n")
lines = SALES.strip().split("\n")
print(str(len(lines[0].split(","))) + "/" + str(len(lines) - 1))
全部评论