Python vs. Perl vs. PHP?

Aahz aahz at pythoncraft.com
Mon Jul 28 21:53:58 EDT 2003


In article <7b454334.0307281742.10274598 at posting.google.com>,
Fazer <faizan at jaredweb.com> wrote:
>
>This is a little off-topic, but I wish to know how would you turn a
>string (or data from a text-file) into an array?  For example, maybe
>turn each \n into an array.
>
>So a string like:
>
>"This is line 1
>This is line 2
>This is line 3"
>
>And so when you read that into a list called text text[0] would the
>"This is line 1".

s.split('\n')
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

This is Python.  We don't care much about theory, except where it intersects 
with useful practice.  --Aahz




More information about the Python-list mailing list