Re: [Tutor] Assistance with UnicodeDecodeError

2015-02-04 Thread James Chapman
Actually, it's more likely that the char you are grabbing is UTF-16 not UTF-8 which is moving into the double byte... * An assumption based on the following output: >>> u = u'\u2014' >>> s = u.encode("utf-16") >>> print(s) ■¶ >>> s = u.encode("utf-32") >>> print(s) ■ ¶ >>> s = u.encode("utf-16L

Re: [Tutor] Assistance with UnicodeDecodeError

2015-02-04 Thread James Chapman
> > I am trying to scrap text from a website using Python 2.7 in windows 8 and > i am getting this error *"**UnicodeDecodeError: 'charmap codec can't encode > character u'\u2014 in position 11231 character maps to "* > > For starters, move away from Python 2 unless you have a good reason to use it.

Re: [Tutor] Assistance with UnicodeDecodeError

2015-02-02 Thread Dave Angel
On 02/02/2015 02:52 AM, Cristian Di Stefano wrote: Hi Dave, you should set the correct encoding (maybe utf-8) in order to handle data from web. You cannot handle unicode data with simple string, you should encode to ASCII or manage data with the unicode type Best Cristian Please don't top-po

Re: [Tutor] Assistance with UnicodeDecodeError

2015-02-02 Thread Cristian Di Stefano
Hi Dave, you should set the correct encoding (maybe utf-8) in order to handle data from web. You cannot handle unicode data with simple string, you should encode to ASCII or manage data with the unicode type Best Cristian Il 31/01/2015 23:44, Dave Angel ha scritto: On 01/31/2015 08:37 AM, J

Re: [Tutor] Assistance with UnicodeDecodeError

2015-01-31 Thread Dave Angel
On 01/31/2015 08:37 AM, J Mberia wrote: Hi, Welcome to Python tutor. Thanks for posting using text email, and for specifying both your Python version and Operating system. I am teaching myself programming in python and assistance with UnicodeDecodeError I am trying to scrap text from a w

Re: [Tutor] Assistance

2011-04-25 Thread Prasad, Ramit
b = + 2 is legal syntax, while b + = 2 is not. Why do you 'b += 2' is not legal syntax? It seems to work in python 2.x and 3.x. Is this deprecated or looked down upon? Is it better to use 'b = b + 2' ? For the +2, it did not even occur to me that it was referring to a positive number and not so

Re: [Tutor] Assistance

2011-04-25 Thread Wayne Werner
On Mon, Apr 25, 2011 at 1:13 PM, Prasad, Ramit wrote: > b = + 2 is legal syntax, while b + = 2 is not. > > Why do you 'b += 2' is not legal syntax? It seems to work in python 2.x and > 3.x. Is this deprecated or looked down upon? Is it better to use 'b = b + 2' > ? > > For the +2, it did not even

Re: [Tutor] Assistance

2011-04-25 Thread Wayne Werner
On Mon, Apr 25, 2011 at 9:59 AM, Prasad, Ramit wrote: > >>while numberOfGrades != gradesEntered: > >>grade = int(raw_input("Please enter the grade:" )) > >>gradesEntered += 1 > >>score =+ grade > > >Note that += and =+ do different things. I suspect this last line is >

Re: [Tutor] Assistance

2011-04-25 Thread Prasad, Ramit
>>while numberOfGrades != gradesEntered: >>grade = int(raw_input("Please enter the grade:" )) >>gradesEntered += 1 >>score =+ grade >Note that += and =+ do different things. I suspect this last line is >not doing what you think. Details like this are very important in >

Re: [Tutor] Assistance

2011-04-24 Thread Alan Gauld
"Krystal Brosz" wrote i'm struggling with a program, i feel like i am really close to getting it You are not far away but you have a few little problems to fix. but i cannot find a way to use the target variables inside of a loop: I have no idea what you mean by "target variables". There

Re: [Tutor] Assistance with Psuedocode

2010-11-17 Thread Dave Angel
On 2:59 PM, Joe Ohmer wrote: Hello, The following code works well but I don't understand why the mysteryEffect code block changes the picture. Doesn’t 64*(r/64) just equal r? (Same with g and b.) So this function should not change the picture at all. But it does! If anyone can explain how and

Re: [Tutor] Assistance with Psuedocode

2010-11-17 Thread Adam Bark
On 18/11/10 00:49, Alan Gauld wrote: "Joe Ohmer" wrote The following code works well but I don't understand why the mysteryEffect code block changes the picture. Doesn’t 64*(r/64) just equal r? That dependfs on which version of Python you use. In earlier versions '/' meant integer division

Re: [Tutor] Assistance with Psuedocode

2010-11-17 Thread Alan Gauld
"Joe Ohmer" wrote The following code works well but I don't understand why the mysteryEffect code block changes the picture. Doesn’t 64*(r/64) just equal r? That dependfs on which version of Python you use. In earlier versions '/' meant integer division so (1/64) * 64=> 0 * 64 (120/64)

Re: [Tutor] Assistance!

2005-08-07 Thread Luis N
On 8/7/05, gordnjen <[EMAIL PROTECTED]> wrote: > > I am now stuck again. I am at my wit's end. The course I am taking is a > supposed "beginners" course. It is a distance education class, and our > textbook does NOT contain the information required to do all of the > assignments (perhaps it was de