可能还有更好的方法,在这里我是这么写的,针对小文件可以,但是如果文件内容太多,这种方法感觉不太好 先把所有的数据读取出来,然后利用W覆盖写入模式打开文件进行写入 遍历枚举类型数据后,默认是从0开始,然后格式化写入即可 with open("test.txt", "r", encoding="utf8") as f: lines = f.readlines() with open("test.txt", "w"
怎么在SQL查询的结果里加行号? 学习了:https://zhidao.baidu.com/question/91188037.html mysql : ) as rowNo From a, () ) b oracle : select a.*,rownum from a sql server : select row_number()over(order by XX)as RowNum,* from a