Hi.
I'm creating a web crawler, I want to send the output into a txt file, how can I do it? And I also want to give a path to the script to set the directory. How can I do it now?

It is very easy to write the output to a text file

with io.open(textfilename, mode='w', encoding='utf-8') as ofh:
    ofh.write(theoutput)

If you want to enter interactively a directory path to save the files, you have 2 solutions: either read the path in the console with the input() method or use a GUI form to select the directory. If your program is already using a gui module, there is probably already a widget to select a directory in your gui module.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.