Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

python help

Name: lol 2009-02-27 0:32

data = inFile.readlines()

when i do that it returns the lines as strings including the "\n"
i however need those to gtfo, how do i do this?

Name: Anonymous 2009-02-27 1:56

Try running it in a Ruby compiler instead.

Name: Anonymous 2009-02-27 2:09

data = [i.rstrip() for i in inFile.readlines()]

if you were using a real language, you could just do this:
@data = grep{chomp}<INFILE>;

Name: Anonymous 2009-02-27 2:10

for line in data: line = line[:-1]

Name: Anonymous 2009-02-27 3:29

chomp()

Name: Anonymous 2009-02-27 6:46

>>1
data = itertools.map(string.rstrip, inFile.readlines())

>>2
Slow as FUCK

>>3
Shit.

>>4
Not elegant

>>5
I chomp'd you're mother.

>>6
Perfect.

Name: Anonymous 2009-02-27 6:51

Say, are you faggots aware that file objects are iterators?

Name: Anonymous 2009-02-27 6:52






Rick Astley's

on the radio





Name: Anonymous 2009-02-27 6:59

unlines

Name: Anonymous 2009-02-27 7:15

Mostly >>6's criticisms are correct; however using itertools for something like this is really pointless, never mind the stupid use of a static string method which was deprecated ages ago. >>3 has the right idea, aside from the redundant use of readlines(), and the fact that it sucks in the entire file at once. Use a generator instead.

data =(i.rstrip() for i in inFile)

Name: Anonymous 2009-02-27 8:44

>>8
yuo have been radiorolled

Name: Anonymous 2009-02-27 17:45

>>9
concat.unlines

Name: Anonymous 2009-02-27 23:19

































































































































































































































































fuck



Name: Anonymous 2009-02-27 23:26

>>13
that was so epic my browser lagged.

Name: Anonymous 2009-02-28 0:39

> > > > > > > > > > > > > > > > wtf h4x

Name: Anonymous 2009-02-28 5:20

>>15








Ha.

Name: Anonymous 2009-02-28 11:04


>
>
>
>
>
>
>

Name: Anonymous 2009-02-28 11:05




>


>
>


>
>
>

Name: Anonymous 2010-11-28 17:01

Name: Anonymous 2010-12-17 1:29

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-03 2:06

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List