从csv文件特定行开始读取数据

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u014229742/article/details/84958778
num = 0
with open('dalian_all.csv', 'rt', encoding='gbk') as csvfile:

    reader = csv.DictReader(csvfile) 
    
    for line in reader:#逐行读取csv文件
    
        num += 1 #每读一行,num+1
        
        #从第45行开始读取数据url
        if num > 44:

            urls = [row['url'] for row in reader]

            for url in urls:

                print(url)
展开阅读全文

没有更多推荐了,返回首页