Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45852
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'importing': 0.05; 'integers': 0.09; 'iterate': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'sys,': 0.09; 'python': 0.11; 'template': 0.14; 'attempted': 0.16; 'comma': 0.16; 'csv': 0.16; 'pythonic': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'separated': 0.16; 'tab': 0.16; 'module': 0.19; 'file,': 0.19; 'thu,': 0.19; 'input': 0.22; 'example': 0.22; 'import': 0.22; 'print': 0.22; 'this?': 0.23; 'url:home': 0.24; '(or': 0.24; 'define': 0.26; 'handling': 0.26; 'header:X-Complaints-To:1': 0.27; 'external': 0.29; 'lines': 0.31; "skip:' 10": 0.31; 'file': 0.32; 'supposed': 0.32; 'charset:us- ascii': 0.36; 'being': 0.38; 'received:76': 0.38; 'to:addr:python- list': 0.38; 'expect': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'new': 0.61; 'range': 0.61; 'email addr:gmail.com': 0.63; 'skip:n 10': 0.64; 'useful.': 0.68; 'cut': 0.74; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: suppress newlines in my script |
| Date | Thu, 23 May 2013 19:11:58 -0400 |
| Organization | > Bestiaria Support Staff < |
| References | <52c74908-8bac-498e-9549-5b9500b152f1@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-76-249-19-5.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 3.3/32.846 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2043.1369350733.3114.python-list@python.org> (permalink) |
| Lines | 41 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369350733 news.xs4all.nl 15947 [2001:888:2000:d::a6]:35755 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45852 |
Show key headers only | View raw
On Thu, 23 May 2013 13:49:02 -0700 (PDT), sloan949@gmail.com declaimed
the following in gmane.comp.python.general:
> I am importing lines from an external csv file and when I iterate through the lines and increment, new lines are introduced.
> How would I cut out the newlines. I have attempted several pythonic strip() and rstrip() how can i implent this?
>
>
> import sys, os
>
> f=open('europe_csv')
> lines=f.readlines()
>
You state it is a comma separated file... Python has, for years, a
module just for handling CSV (or tab separated, or even others if you
define the "dialect").
> BU = 'Company,,,,,,,,,,,,,,'
> PPP = 'Pre-Prod,,,,,,,,Prod,,,,,,'
> C1 = ',,,,,,,,,,,,,,'
> Title = 'Site,Environment,'
> NET1 = lines[4]
What is "lines[4]" supposed to look like?
<snip>
>
>
> for count in range(64, 127):
> print NET1.format(count)
And what do you expect this to produce? NET1 is being used as a
template into which you are placing (if it has a placeholder) integers
in the range 64..126
An example of the input file, and an example of what you expect to
produce with it, would be useful.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
suppress newlines in my script sloan949@gmail.com - 2013-05-23 13:49 -0700
Re: suppress newlines in my script Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-05-23 19:11 -0400
Re: suppress newlines in my script sloan949@gmail.com - 2013-05-24 06:59 -0700
Re: suppress newlines in my script Dave Angel <davea@davea.name> - 2013-05-24 15:24 -0400
Re: suppress newlines in my script Jason Friedman <jsf80238@gmail.com> - 2013-05-24 21:49 -0600
Re: suppress newlines in my script Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-05-25 13:33 -0400
csiph-web