Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39235
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: IOerror : need urgent help |
| Date | 2013-02-19 15:49 +0000 |
| References | <CAFqGZREMOm4YSntzwie8o=RmusdV8KzrggY0wK8w4vCXWuwmBw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2034.1361288958.2939.python-list@python.org> (permalink) |
On 19/02/2013 15:27, inshu chauhan wrote:
> Here is my attempt to merge 10 files stored in a folder into a single file :
>
> import csv
>
> with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w:
> writer = csv.writer(w)
> for f in glob.glob("C:\Users\inshu.chauhan\Desktop\For
> Model_600\*.arff"):
> rows = open(f, "r").readlines()
> writer.writerows(rows)
>
>
> Error:
>
> Traceback (most recent call last):
> File "C:\Users\inshu.chauhan\Desktop\Mergefiles.py", line 3, in <module>
> with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w:
> IOError: [Errno 22] invalid mode ('w') or filename:
> 'C:\\Users\\inshu.chauhan\\Desktop\test.arff'
>
> Why my programme is not working ?? :(
>
> Thanks in Advance !!
>
Use a raw string for the output file name or forward instead of back
slashes. Explanation here
http://docs.python.org/2/reference/lexical_analysis.html
--
Cheers.
Mark Lawrence
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: IOerror : need urgent help Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 15:49 +0000
csiph-web