Re: [Tutor] simple unicode question

2014-08-22 Thread Steven D'Aprano
On Fri, Aug 22, 2014 at 02:10:21PM -0700, Albert-Jan Roskam wrote: > Hi, > > I have data that is either floats or byte strings in utf-8. I need to > cast both to unicode strings. I am probably missing something simple, > but.. in the code below, under "float", why does [B] throw an error > but

Re: [Tutor] simple unicode question

2014-08-22 Thread Ben Finney
Danny Yoo writes: > Hi Albert, > > Just following up: I consider the 2 (or 3) arg form of unicode() to be > a design flaw in the Standard Library. It's redundant because the > bytes type already has a decode() method: > > https://docs.python.org/3/library/stdtypes.html#bytes.decode > > > So

Re: [Tutor] simple unicode question

2014-08-22 Thread Danny Yoo
Hi Albert, Just following up: I consider the 2 (or 3) arg form of unicode() to be a design flaw in the Standard Library. It's redundant because the bytes type already has a decode() method: https://docs.python.org/3/library/stdtypes.html#bytes.decode So I would personally write convert() l

Re: [Tutor] simple unicode question

2014-08-22 Thread Danny Yoo
On Fri, Aug 22, 2014 at 2:10 PM, Albert-Jan Roskam wrote: > Hi, > > I have data that is either floats or byte strings in utf-8. I need to cast > both to unicode strings. Just to be sure, I'm parsing the problem statement above as: data :== float | utf-8-encoded-byte-string

Re: [Tutor] simple unicode question

2014-08-22 Thread Dave Angel
Albert-Jan Roskam Wrote in message: > Hi, > > I have data that is either floats or byte strings in utf-8. I need to cast > both to unicode strings. I am probably missing something simple, but.. in the > code below, under "float", why does [B] throw an error but [A] does not? > >.. >>>

[Tutor] Preparing virtualenvwrapper for Django 1.6 development

2014-08-22 Thread Sithembewena Lloyd Dube
Hi everyone, I am developing on a Windows 8.1 machine and wold like to setup virtualenvironment via virtualenvwrapper so as to have a properly set up Python development environment. I am referring to Jeff Knupp's guide at http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-r

[Tutor] simple unicode question

2014-08-22 Thread Albert-Jan Roskam
Hi, I have data that is either floats or byte strings in utf-8. I need to cast both to unicode strings. I am probably missing something simple, but.. in the code below, under "float", why does [B] throw an error but [A] does not? # Python 2.7.3 (default, Feb 27 2014, 19:39:10) [GCC 4.7.2] on l

Re: [Tutor] Please get me started in django

2014-08-22 Thread Joel Goldstick
On Fri, Aug 22, 2014 at 9:48 AM, wrote: > Hi > > I have developed a python maths game in 2.7 and want to try and run it from > the web. PLEASE can you guide me in getting started. Im not very familiar > with command line operations. > > I have installed python 3.4 does that help. > > If this i

[Tutor] Please get me started in django

2014-08-22 Thread atp2gr
Hi I have developed a python maths game in 2.7 and want to try and run it from the web. PLEASE can you guide me in getting started. Im not very familiar with command line operations. I have installed python 3.4 does that help. If this is not the best place to get help with django can

Re: [Tutor] Question about if functions

2014-08-22 Thread Steven D'Aprano
On Fri, Aug 22, 2014 at 02:43:20AM +, Mimi Ou Yang wrote: > if (name and age == jimmy and 35): > print ("BLABLABLABLABLABLAB") if name == 'jimmy' and age == 35: print("BLAB") or if you prefer: if (name, age) == ("jimmy", 35): print("BLAB") Take careful note that strings like "