Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 10:53, "Νικόλαος Κούρας" wrote: > > After many tried this did the job: > > for key in sorted(months.items(),key=lambda num : num[1]): > print(''' > %s > ''' % (key[1], key[0]) ) > > > but its really frustrating not being able to: > > for key in sort

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
> s = 'α' > s.encode('utf-8') > > b'\xce\xb1' 'b' stands for binary right? b'\xce\xb1' = we are looking at a byte in a hexadecimal format? if yes how could we see it in binary and decimal represenation? > > I see that the encoding of this char takes 2 bytes. But why two exactly

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
After many tried this did the job: for key in sorted(months.items(),key=lambda num : num[1]): print(''' %s ''' % (key[1], key[0]) ) but its really frustrating not being able to: for key in sorted( months.values() ): print(''' %s

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 09:34, "Νικόλαος Κούρας" wrote: > > Trying this: > > months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ >'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } > > for key in sorted( mo

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 11:15:38 π.μ. UTC+3, ο χρήστης Andreas Perstinger έγραψε: What is the difference between len('nikos') and len(b'nikos') First beeing the length of string nikos in characters while the second being the length of an ??? > The python interpreter will represent all valu

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
Trying this: months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ 'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } for key in sorted( months.values() ): print(''' %s

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 11:16:37 π.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε: > What if i wanted to sort it out if alphabetically and not by the values? > > > > Thsi worked: > > > > for item in sorted(months.items(),key=lambda num : num[1]): > > > > but this failed: > > > > for it

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
What if i wanted to sort it out if alphabetically and not by the values? Thsi worked: for item in sorted(months.items(),key=lambda num : num[1]): but this failed: for item in sorted(months.items()): why? -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Andreas Perstinger
On 10.06.2013 09:10, nagia.rets...@gmail.com wrote: Τη Κυριακή, 9 Ιουνίου 2013 3:31:44 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: py> c = 'α' py> ord(c) 945 The number 945 is the characters 'α' ordinal value in the unicode charset correct? Yes, the unicode character set is just a big li

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 10:51:34 π.μ. UTC+3, ο χρήστης Larry Hudson έγραψε: > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant > > up to 256, not above 256. > 0 - 127, yes. > 128 - 255 -> one byte of a multibyte code. you mean that in utf-8 for 1 character to be s

Re: Redirecting to a third party site with injected HTML

2013-06-10 Thread Denis McMahon
On Sun, 09 Jun 2013 10:09:17 -0700, guytamir1 wrote: > i'm not really sure how to approach this problem.. > hints :) Let me restate the problem for you: You want to display a web page to a visitor that exists on a third party website, with some of your own html inserted into it. Setting aside

Re: Redirecting to a third party site with injected HTML

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 07:58, "Guy Tamir" wrote: > since i wrote some extensions in the past that allowed me to change the DOM easily i thought there might be an way to do so from the server before redirecting the user.. There could be a way to do that, but some of the features in the target site would n

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Larry Hudson
On 06/09/2013 03:37 AM, Νικόλαος Κούρας wrote: I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. NO!! 0 - 127, yes. 128 - 255 -> one byte of a multibyte code. That's why the decode fails, it sees it as incomplete data so it can't do anythi

Re: problem with if then

2013-06-10 Thread Jean Dubois
On 9 jun, 23:35, Roy Smith wrote: > In article > <20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com>, >  Jean Dubois wrote: > > > But, really, > > > once you've done all that (and it's worth doing as an exercise), rewrite > > > your code to use urllib2 or requests.  It'll be a lot

Re: Re-using copyrighted code

2013-06-10 Thread Mark Janssen
>>> Can you provide any citations for your interpretation? Besides "that's >>> what the law should be", I mean. >> >> I don't think I even have to: the legal code you're citing above is >> not very clear, consistent, or well-defined at all. As such, it shows >> that this area remains an area that

Re: Re-using copyrighted code

2013-06-10 Thread Chris Angelico
On Mon, Jun 10, 2013 at 4:42 PM, Malte Forkel wrote: > Had I known in the beginning how convoluted things would become, I might > have considered two other options: Just publish or keep the code to > myself. But I still think, first understanding the legal aspects and > then publishing (to give b

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread nagia . retsina
Τη Κυριακή, 9 Ιουνίου 2013 3:31:44 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > py> c = 'α' > py> ord(c) > 945 The number 945 is the characters 'α' ordinal value in the unicode charset correct? The command in the python interactive session to show me how many bytes this character will take u

<    1   2