Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

Python - Just wondering if someone can do a quick count script for reading a file and number of URLS within the file

$
0
0

Sorry this is a real beginner question.I have a file with a number of URL's in it - I want to read the file and do a count for every URL in the file.

file = open("URL.txt", "r")Counter = 0Content = file.read()CoList = Content.split("\n")for i in CoList:    if i:        Counter += 1print("This is the number of lines in the file")print(Counter)

This works for me, but its a line count and ignoring the URL factor - which I dont know how to do


Viewing all articles
Browse latest Browse all 14215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>