[Nick]
> Why is there a apostrophe still at the end?
[Stephen]
> Is it possible that you actually have whitespace at the end
> of the line?
It's the newline - reading lines from a file doesn't remove the newlines:
from cStringIO import StringIO
DATA = """\
'AF':'AFG':'004':'AFGHANISTAN':'Afgha
On 21 Jun, 14:53, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-06-21, Nick <[EMAIL PROTECTED]> wrote:
>
>
>
> > strip() isn't working as i expect, am i doing something wrong -
>
> > Sample data in file in.txt:
>
> > 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan'
> > 'AL':'ALB':'008':'ALBANIA':'A
Nick wrote:
> strip() isn't working as i expect, am i doing something wrong -
>
> Sample data in file in.txt:
>
> 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan'
> 'AL':'ALB':'008':'ALBANIA':'Albania'
> 'DZ':'DZA':'012':'ALGERIA':'Algeria'
> 'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa'
>
>
On 2007-06-21, Nick <[EMAIL PROTECTED]> wrote:
> strip() isn't working as i expect, am i doing something wrong -
>
> Sample data in file in.txt:
>
> 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan'
> 'AL':'ALB':'008':'ALBANIA':'Albania'
> 'DZ':'DZA':'012':'ALGERIA':'Algeria'
> 'AS':'ASM':'016':'AMERICA
On Thu, Jun 21, 2007 at 01:42:03PM +, linuxprog wrote:
> that should work for you ?
I reproduced the original poster's problem by adding one
extra space after the final "'" on each line. I'd vote that
that's the problem.
--
Stephen R. Laniel
[EMAIL PROTECTED]
Cell: +(617) 308-5571
http://lan
In article <[EMAIL PROTECTED]>,
Nick <[EMAIL PROTECTED]> wrote:
> strip() isn't working as i expect, am i doing something wrong -
>
> Sample data in file in.txt:
>
> 'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan'
> 'AL':'ALB':'008':'ALBANIA':'Albania'
> 'DZ':'DZA':'012':'ALGERIA':'Algeria'
> 'AS'
Stephen R Laniel a écrit :
On Thu, Jun 21, 2007 at 06:23:01AM -0700, Nick wrote:
Why is there a apostrophe still at the end?
Is it possible that you actually have whitespace at the end
of the line? So then strip() is looking for an apostrophe at
the end of the line, not finding it, and
On Thu, Jun 21, 2007 at 06:23:01AM -0700, Nick wrote:
> Why is there a apostrophe still at the end?
Is it possible that you actually have whitespace at the end
of the line? So then strip() is looking for an apostrophe at
the end of the line, not finding it, and therefore not
stripping it?
--
Ste
strip() isn't working as i expect, am i doing something wrong -
Sample data in file in.txt:
'AF':'AFG':'004':'AFGHANISTAN':'Afghanistan'
'AL':'ALB':'008':'ALBANIA':'Albania'
'DZ':'DZA':'012':'ALGERIA':'Algeria'
'AS':'ASM':'016':'AMERICAN SAMOA':'American Samoa'
Code:
f1 = open('in.txt', 'r')