Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54361
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-09-18 00:44 -0700 |
| References | <41edba54-31d3-48ad-a50f-41f87f32d251@googlegroups.com> |
| Message-ID | <19f72b93-27c8-4426-9a97-25d88a9be702@googlegroups.com> (permalink) |
| Subject | Re: *.csv to *.txt after adding columns |
| From | rusi <rustompmody@gmail.com> |
On Wednesday, September 18, 2013 7:12:21 AM UTC+5:30, Bryan Britten wrote: > Hey, gang, I've got a problem here that I'm sure a handful of you will know how to solve. I've got about 6 *.csv files that I am trying to open; change the header names (to get rid of spaces); add two new columns, which are just the results of a string.split() command; drop the column I just split; and then finally export to *.txt files. Here's the code I'm using: Its generally a good idea in programming to separate separable problems. Since you say: > The issue I'm having is that the *.txt files I'm generating are empty. I > assume some unraised error is being thrown, but I'm new to Python and am self > taught, so I don't know where to look or how to troubleshoot. > When I run the code on just one file and print the output instead of writing > it, it looks exactly like what I'd want. So I'm at a loss for where the > problem is. you should probably write and have checked the code that handles one file. For example a function that takes as parameters the two: the input/output files (maybe names or handles), and then - check that that function works for one file - call it in your loop [BTW your code seems to mixup the variable-names for file-names and handles]
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
*.csv to *.txt after adding columns Bryan Britten <britten.bryan@gmail.com> - 2013-09-17 18:42 -0700
Re: *.csv to *.txt after adding columns Dave Angel <davea@davea.name> - 2013-09-18 02:18 +0000
Re: *.csv to *.txt after adding columns Bryan Britten <britten.bryan@gmail.com> - 2013-09-17 19:28 -0700
Re: *.csv to *.txt after adding columns Dave Angel <davea@davea.name> - 2013-09-18 07:55 +0000
Re: *.csv to *.txt after adding columns Peter Otten <__peter__@web.de> - 2013-09-18 09:14 +0200
Re: *.csv to *.txt after adding columns rusi <rustompmody@gmail.com> - 2013-09-18 00:44 -0700
Re: *.csv to *.txt after adding columns Bryan Britten <britten.bryan@gmail.com> - 2013-09-18 04:42 -0700
Re: *.csv to *.txt after adding columns Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-09-18 18:47 -0400
csiph-web