Heres my code.
import os, sys
if len(sys.argv) != 2:
sys.exit(1)
h = os.popen("wget -r %s") % sys.argv[1]
fil = open("links.txt","w")
dir = os.listdir("%s") % sys.argv[1]
for file in dir:
print file.replace("@","?")
fil.write("%s/"+file.replace("@","?")) % sys.argv[1]
fil.write("\n")
h.close()
running the it, like this python project.py http://google.com
gives me error code.
1.py:5 RuntimeWarning: tp_compare didnt return -1 or -2 for exception
h = os.popen("wget -r %s") % sys.argv[1]
Traceback (most recent call last):
File "1.py" line 5, in <module>
h = os.popen("wget -r %s") % sys.argv[1]
TypeError: unsupported operand type<s> for %: 'file' and 'str'
What are im going wrong. (Still learning python) Any solution/ tip?
I dont explain the code, i think you understand what im trying to do