Sorry for double-post.

I did as you said, now I get this:

[image: Imagem inline 1]

I did a 'print(line)' and it seems to be working, " b'# The daily noon
exchange rates for major foreign currencies are published every business
day at about 12:30' ".

Code: http://pastebin.com/SgVdeKGm


2014-08-30 19:18 GMT-03:00 Juan Christian <juan0christ...@gmail.com>:

> I analyzed the code and found two mistakes:
>
> 1. I wrote 'startsWith', and not 'startswith'
> 2. I forgot to encode, I needed to use '.read().decode("utf-8")' rather
> than '.read()' only.
>
> This way I get the text correctly (http://pastebin.com/qy4SVdzK). I'm
> still analyzing the code and fixing things, the program isn't 100% working
> yet.
>
>
>
>
>
>
> 2014-08-30 19:03 GMT-03:00 Danny Yoo <d...@hashcollision.org>:
>
> > So the loop really should be:
>> >
>> >         for line in fh.split("\n"):
>> >               ...
>>
>>
>> Ah, apologies.  Forgot that we're in Python 3 land.  We have to be
>> consistent with the types a lot more.  This should be:
>>
>>          for line in fh.split(b"\n"):
>>                ...
>>
>> Apologies.  I should have tested with a Python 3 interpreter in hand.
>>
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to