Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99596
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Denis McMahon <denismfmcmahon@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: reading from a txt file |
| Date | Thu, 26 Nov 2015 20:50:26 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 14 |
| Message-ID | <n37rah$h02$8@dont-email.me> (permalink) |
| References | <175ab5d2-d8e3-44e7-a71f-88b3153daf89@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Thu, 26 Nov 2015 20:50:26 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="66ffcfa4470a58bcddbdcd1913f98ab4"; logging-data="17410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vc2/KBmenSf0DpHvtB1OqY4ndseNgeDI=" |
| User-Agent | Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2) |
| Cancel-Lock | sha1:cAc0W8sAlnp5MLY2zv2A9FvTH/U= |
| Xref | csiph.com comp.lang.python:99596 |
Show key headers only | View raw
On Thu, 26 Nov 2015 12:34:36 -0800, vincentypedro wrote:
> Hey, I'm wondering how to read individual strings in a text file. I can
> read a text file by lines with .readlines() ,
> but I need to read specifically by strings, not including spaces.
> Thanks in advance
How do you define a string? Is it just a line with the spaces removed?
>>> "".join(" this is a test string my friends ".split(" "))
'thisisateststringmyfriends'
--
Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
reading from a txt file vincentypedro@gmail.com - 2015-11-26 12:34 -0800
Re: reading from a txt file Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-26 20:50 +0000
Re: reading from a txt file Jason Friedman <jsf80238@gmail.com> - 2015-11-26 14:04 -0700
Re: reading from a txt file Gary Herron <gherron@digipen.edu> - 2015-11-26 13:01 -0800
Re: reading from a txt file Pedro Vincenty <vincentypedro@gmail.com> - 2015-11-26 17:24 -0800
Re: reading from a txt file Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-26 21:44 -0500
csiph-web