Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73730
| From | Roy Smith <roy@panix.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Writing Multiple files at a times |
| Date | 2014-06-29 10:01 -0400 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <roy-AFAF93.10013729062014@news.panix.com> (permalink) |
| References | <b8951113-5171-4441-b490-4d731eb56cec@googlegroups.com> <mailman.11325.1404048700.18130.python-list@python.org> |
In article <mailman.11325.1404048700.18130.python-list@python.org>, Dave Angel <davea@davea.name> wrote: > subhabangalore@gmail.com Wrote in message: > > Dear Group, > > > > I am trying to crawl multiple URLs. As they are coming I want to write them > > as string, as they are coming, preferably in a queue. > > > > If any one of the esteemed members of the group may kindly help. > > > > >From your subject line, it appears you want to keep multiple files open, > >and write to each in an arbitrary order. That's no problem, up to the > >operating system limits. Define a class that holds the URL information and > >for each instance, add an attribute for an output file handle. > > Don't forget to close each file when you're done with the corresponding URL. One other thing to mention is that if you're doing anything with fetching URLs from Python, you almost certainly want to be using Kenneth Reitz's excellent requests module (http://docs.python-requests.org/). The built-in urllib support in Python works, but requests is so much simpler to use.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Writing Multiple files at a times subhabangalore@gmail.com - 2014-06-29 03:49 -0700
Re: Writing Multiple files at a times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-29 12:17 +0100
Re:Writing Multiple files at a times Dave Angel <davea@davea.name> - 2014-06-29 09:33 -0400
Re: Writing Multiple files at a times Roy Smith <roy@panix.com> - 2014-06-29 10:01 -0400
Re: Writing Multiple files at a times subhabangalore@gmail.com - 2014-06-29 10:32 -0700
Re: Writing Multiple files at a times Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-29 19:21 +0000
Re: Writing Multiple files at a times subhabangalore@gmail.com - 2014-06-30 12:23 -0700
Re: Writing Multiple files at a times Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-30 23:22 +0000
csiph-web