> See the competition timetable (including competition dates in various
> timezones), rules, sign-up (commencing 6th August) at:
>
> http://www.mechanicalcat.net/tech/PyWeek
>
Sounds like fun.
One thing. From the website ...
> Clip Art
> note:
> more links welcome
How about:
http://www.open
What is Expresiveness in a Computer Language
20050207, Xah Lee.
In languages human or computer, there's a notion of expressiveness.
English for example, is very expressive in manifestation, witness all
the poetry and implications and allusions and connotations and
dictions. There are a m
Most participants in the computering industry should benefit in reading
this essay:
George Orwell's “Politics and the English Language”, 1946.
Annotated:
http://xahlee.org/p/george_orwell_english.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/pyth
oriented communist/socialist
nations or sovereignly ruled kingdoms & queendoms.
this post is archived at:
http://xahlee.org/UnixResource_dir/writ/mshatred155.html
© copyright 2003 by Xah Lee.
Xah
[EMAIL PROTECTED]
â http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-07-22, Girish <[EMAIL PROTECTED]> wrote:
> Hi ,
>
> I wanna do some automation work using "pexpect".
> I have an application which must be invoked from the command line in
> linux environment,it consists of buttons,textboxes etc can i access
> those widgets using "pexpect",say i wanna enter
Subscribe
Thanks,
Brian Lee
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-08-01, Rob Conner <[EMAIL PROTECTED]> wrote:
> So this is simple, why can't I run the following code? I've tried many
> variances of this, but simply cannot inherit from datetime or
> datetime.datetime. I get this on line 3.
> TypeError: function takes at most 2 arguments (3 given)
>
>
Jargons of Info Tech industry
(A Love of Jargons)
Xah Lee, 2002 Feb
People in the computing field like to spur the use of spurious jargons.
The less educated they are, the more they like extraneous jargons, such
as in the Unix & Perl community. Unlike mathematicians, where in
mathematics t
Unix, RFC, and Line Truncation
[Note: unix tradition requires that a return be inserted at every 70
characters in email messages or so so that each line are less than 80
characters. Unixers made this as a requirement into an RFC document.]
Xah Lee, 20020511
This truncation of lines business is
Here is the source:
#! /bin/python
[EMAIL PROTECTED] This is a xunit test framework for python, see TDD for more
details
class TestCase:
def setUp(self):
print "setUp in TestCase"
pass
def __init__(self, name):
print "__init__ in Te
previously i've made serious criticisms on Python's documentations
problems.
(see http://xahlee.org/perl-python/re-write_notes.html )
I have indicated that a exemplary documentation is Wolfram Research
Incorporated's Mathematica language. (available online at
http://documents.wolfram.com/mathemati
today i need to use Python to decompress gzip files.
since i'm familiar with Python doc and have 10 years of computing
experience with 4 years in unix admin and perl, i have quickly located
the official doc:
http://python.org/doc/2.4.1/lib/module-gzip.html
but after a minute of scanning, please
Today i need to use Python to compress/decompress gzip files.
I quickly found the official doc:
http://python.org/doc/2.4.1/lib/module-gzip.html
I'd imagine it being a function something like
GzipFile(filePath, comprress/decompress, outputPath)
however, scanning the doc after 20 seconds there's
Apache by default uses the following format for date:
30/Aug/2005
is there a module that turn this directly into mmdd?
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
By the way, i have sent my criticisms to the proper python doc
maintainer or mailing list several months ago.
-
i'm very sorry to say, that the Python doc is one of the worst possible
in the industry. I'm very sick of Perl and its intentional obfuscation
and juvenile drivel style of i
On Python's Documentation
Xah Lee, 20050831
I'm very sorry to say, that the Python doc is one of the worst possible
in the industry. I'm very sick of Perl and its intentional obfuscation
and juvenile drivel style of its docs. I always wanted to learn Python
as a replacement of
Xah Lee enlightened us with:
> > but after a minute of scanning, please someone tell me what the fuck
> > is it talking about?
>
> How difficult is it? The first line of the Gzip class explains it all
> to me: "Constructor for the GzipFile class, which simulates most of
&
I have been searching for the answer to this as it will determine how I use
classes. Here are two bits of code.
class foo1:
def __init__(self, i):
self.r = i
self.j = 5
>>h = foo1(1)
>>h.r
1
>>h.j
5
Now take this example
class foo2:
def __init__(self):
self.j
i noticed that Python uses various logos:
http://python.org/pics/pythonHi.gif
http://python.org/pics/PyBanner038.gif
http://python.org/pics/PyBanner037.gif
http://python.org/pics/PythonPoweredSmall.gif
http://wiki.python.org/pics/PyBanner057.gif
is this some decision that python should use vario
identity and as well as advertisement.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Steve Holden wrote:
> Xah Lee wrote:
> > i noticed that Python uses various logos:
> >
> > http://python.org/pics/pythonHi.gif
> > http://python.org/pics/PyBanner038.gif
> > http://
does anyone know why the folllowing prints to the screen?
# python
import os
os.system(r"ls")
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
> This is all pretty basic stuff. Perhaps you should stop your verbal
> assault on the computer science community and start to learn the
> principles of what you are doing.
is this a supressed behavior that a human animal can finally
instinctively and justifiably release at ano
do you know what the Muses do when a mortal challenged them?
And, please tell me exactly what capacity you hold under the official
Python organization so that i can calculate to what degree i can kiss
your ass or feign mum of your ignorance.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Steve Hol
Python Doc Problem Example: os.system
Xah Lee, 2005-09
today i'm trying to use Python to call shell commands. e.g. in Perl
something like
output=qx(ls)
in Python i quickly located the the function due to its
well-named-ness:
import os
os.system("ls")
however, according
On 2005-09-05, mclaugb <[EMAIL PROTECTED]> wrote:
> I am trying to pass the name of several files to a python script as command
> line arguments. When i type in
>
>
> python ImportFiles_test.py C:\Program Files\National Instruments\LabVIEW
> 7.1\project\calibration\FREQUENCY_
> 13.CSV
>
> The fo
On 2005-09-05, es_uomikim <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have one small simple question, that I didn't found answer in
> google's. It's kind of begginers question because I'm a one. ; )
>
> I wanned to ask how to use scripts with vars on input like this:
>
> $ echo "something" | ./my_scrip
Xah Lee wrote:
> does anyone know why the folllowing prints to the screen?
> # python
> import os
> os.system(r"ls")
Steve Holden wrote:
> It only prints to the screen when standard output of the invoking
> process is the screen. The sub-process forked by os.system
suppose i'm calling two system processes, one to unzip, and one to
“tail” to get the last line. How can i determine when the first
process is done?
Example:
subprocess.Popen([r"/sw/bin/gzip","-d","access_log.4.gz"]);
last_line=subprocess.Popen([r"/usr/bin/tail","-n 1","access_log.4"],
stdout=sub
Thanks all.
I found the answer, rather easily.
To make a system call and wait for it, do:
subprocess.Popen([r"/sw/bin/gzip","-d","access_log.4.gz"]).wait();
--
this post is archived at:
http://xahlee.org/perl-python/system_calls.html
Xah
[EMAIL PROTECTED]
Martin Franklin wrote:
> import gzip
> log_file = gzip.open("access_log.4.gz")
> last_line = log_file.readlines()[-1]
> log_file.close()
does the
log_file.readlines()[-1]
actually read all the lines first?
i switched to system call with tail because originally i was using a
pure Python solution
isn't there a way to implement tail in python with the same class of
performance?
how's tail implemented?
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Fredrik Lundh wrote:
> Fredrik Lundh wrote:
>
> > zcat|tail is a LOT faster.
>
> and here's the "right way" to use that:
>
> from subprocess
Hi,
I'm new in python and I was wondering what's the difference between
the two code section below:
(I)
class TestResult:
_pass_ = "pass"
_fail_ = "fail"
_exception_ = "exception"
(II)
class TestResult:
pass = "pass"
fail = "fail"
exception = "ex
As what you said, the following two code section is totally the same?
(I)
class TestResult:
_passxxx_ = "pass"
(II)
class TestResult:
passxxx = "pass"
--
http://mail.python.org/mailman/listinfo/python-list
Erik Max Francis wrote:
>
> No, of course not. One defines a class varaible named `_passxxx_', the
> other defines one named `passsxxx'.
>
I mean besides the difference of name...
--
http://mail.python.org/mailman/listinfo/python-list
Erik Max Francis wrote:
>
> You're going to have to be more clear; I don't understand your question.
> What's the difference between
>
> a = 1
>
> and
>
> b = 1
>
> besides the difference of name?
>
I thought there must be something special when you named a VAR with '_'
the first ch
in the regex module re:
Note: Match() is not exactly equivalent to Search() with "^". For
example:
re.search(r'^B', 'A\nB',re.M) # succeeds
re.match(r'B', 'A\nB',re.M) # fails
if without the re.M, would re.search and re.match be equivalent?
i wish to spruce up the rewritten re
Hi,
I've met a problem to understand the code at hand. And I wonder
whether there is any useful tools to provide me a way of step debug?
Just like the F10 in VC...
Thanks for your help.
Regards,
Johnny
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Look at the follow command in python command line, See what's
interesting?:)
>>> class A:
i = 0
>>> a = A()
>>> b = A()
>>> a.i = 1
>>> print a.i, b.i
1 0
---
>>> class A:
arr = []
>>> a = A()
>>> b = A()
>>> a
<__main__.A instance at 0x
bruno modulix wrote:
>
> I dont see anything interesting nor problematic here. If you understand
> the difference between class attributes and instance attributes, the
> difference between mutating an object and rebinding a name, and the
> attribute lookup rules in Python, you'll find that all thi
Roy Smith wrote:
>
> For closer control over output, use the write() function. You want
> something like:
>
> import sys
> for i in range(3):
>sys.stdout.write (str(i))
here is the output of my machine:
>>> import sys
>>> for i in range(3):
... sys.stdout.write(str(i))
...
012>>>
Python Doc Problem Example
Quote from:
http://docs.python.org/lib/module-os.path.html
--
split( path)
Split the pathname path into a pair, (head, tail) where tail is the
last pathname component and head is everything leading up to that. The
tail part will never contain a slash
left out.
---
This post is archived at:
http://xahlee.org/perl-python/python_doc_os_path_split.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Xah Lee wrote:
> Python Doc Problem Example
>
> Quote from:
> http://docs.python.org/lib/module-os.path.html
> --
> s
Perl's documentation has come of age: http://perldoc.perl.org/
Python morons really need to learn:
• ample example codes.
• example codes are linked to the appropriate doc location for each
code word in the example.
• written in a task-oriented style, or manifest-functionality style.
That is, i
On 2005-02-06, Brian Beck <[EMAIL PROTECTED]> wrote:
>> Refactoring a database on a live system is a giant pain in the ass,
>> simpler file-based approaches make incremental updates easier.
>>
> As much as I hate working with relational databases, I think you're
> forgetting the reliability even
>> Not only that, but with a well-design RDBMS you can put your
>> schema changes inside of a transaction and make sure everything
>> is right before committing.
>>
> Bear in mind, however, that *most* common RDBMS will treat each DDL
> statement as implicitly committing, so transactional change
20050207 text pattern matching
# -*- coding: utf-8 -*-
# Python
# suppose you want to replace all strings of the form
#
# to
#
# in your html files.
# you can use the "re" module.
import re
text = r'''
blab blab
look at this pict
and this one , both are
beautiful, but also look: , and sequ
is it possible to write python code without any indentation?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
i thought it is trivial for the Python parser to spit out a version
with matching brackets. Similarly, perhaps some opensourcing student
has modified a parser to read in a matching brackets delimited version
of Python.
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://ma
a year ago i wrote this perl program as part of a larger program.
as a exercise of fun, let's do a python version. I'll post my version
later today.
=pod
combo(n) returns a collection with elements of pairs that is all
possible combinations of 2 things from n. For example, combo(4)
returns {'3,4
On 2005-02-10, maxime <[EMAIL PROTECTED]> wrote:
> Hi, I try to develop a game in python and pygame.
> In my game I play a music (.mid with pygame.mixer.music) but sometime
> I need to accelerate it but I don't see how to do that with pygame. Is
> it possible? If not, do you know an other python mu
David Eppstein's code is very nice.
Here's the python version of the perl code:
©# -*- coding: utf-8 -*-
©# Python
©
©def combo (n):
©'''returns all possible (unordered) pairs out of n numbers 1 to
n.
©
©Returns a dictionary. The keys are of the form "n,m",
©and their values are tuple
# -*- coding: utf-8 -*-
# Python
# David Eppstein of the Geometry Junkyard fame gave this elegant
# version for returing all possible pairs from a range of n numbers.
def combo2(n):
return dict([('%d,%d'%(i+1,j+1),(i+1,j+1)) for j in range(n) for i
in range(j)])
print combo2(5)
# this constr
here's a interesting real-world algoritm to have fun with.
attached below is the Perl documentation that i wrote for a function
called "reduce", which is really the heart of a larger software.
The implementation is really simple, but the key is to understand what
the function should be. I'll post
here are the answers:
Perl code:
sub reduce ($$) {
my %hh= %{$_[0]}; # e.g. {'1,2'=>[1,2],'5,6'=>[5,6],...}
my ($j1,$j2)=($_[1]->[0],$_[1]->[1]); # e.g. [3,4]
delete $hh{"$j1,$j2"};
foreach my $k (keys %hh) {
$k=~m/^(\d+),(\d+)$/;
my ($k1,$k2)=($1,$2);
if ($k1==$j1) {
my Python coding is not experienced. In this case, is
ps.pop("%d,%d"%(j[1],k[1]),0) out of ordinary?
if i have long paragraphs of documentation for a function, do i still
just attach it below the fun def?
Xah
Xah Lee wrote:
> here are the answers:
>
> ©Python code.
> ©
I read the comment of
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277753.
(Title : Find and replace string in all files in a directory)
"perl -p -i -e 's/change this/..to this/g'" trick looks handy.
Does Python have a similar trick? Or, is there a shorter Python recipe for
the given pr
ps.pop("%d,%d"%(j[1],k[0]),0)
©return ps
©
©is reduce2 more efficient? It works entirely differently. I'll have
to think about it... besides algorithmic... onto the minute academic
diddling, i wonder if it is faster to delete entries in dict or add
entries...
Xah
[EMAIL
Xah Lee wrote:
> In imperative languages such as Perl and Python and Java, in general
it
> is not safe to delete elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a copy first, and work
with
> the copy.
Correction:
When looping thru a list
Xah Lee wrote:
> In imperative languages such as Perl and Python
> and Java, in general it is not safe to delete
> elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a
> copy first, and work with the copy.
Correction:
When looping thru a l
Xah Lee wrote:
> In imperative languages such as Perl and Python
> and Java, in general it is not safe to delete
> elements when looping thru a list-like entity.
> (it screws up the iteration) One must make a
> copy first, and work with the copy.
Correction:
When looping thru a l
here's another interesting algorithmic exercise, again from part of a
larger program in the previous series.
Here's the original Perl documentation:
=pod
merge($pairings) takes a list of pairs, each pair indicates the
sameness
of the two indexes. Returns a partitioned list of same indexes.
For
here's the answer to the partition by equivalence exercise.
---
# Perl code
sub merge($) {
my @pairings = @{$_[0]};
my @interm; # array of hashs
# chop the first value of @pairings into @interm
$interm[0]={$pairings[0][0]=>'x'}; ${interm[0]}{$pairings[0]
The GOTO statement from Perl has been messed up.
This block:
©for group in interm:
©for newcoup in fin:
©for k in group.keys():
©if newcoup.has_key(k):
©for kk in group.keys(): newcoup[kk]='x';
©break
©break
©
an interesting problem so developed now is to write a function that
generate test cases for the purpose of testing performance. (just for
fun)
the design of this function could be interesting. We want to be able to
give parameters in this function so as to spit out all possible screw
test cases. F
when i try to run the following program, Python complains about some
global name frozenset is not defined. Is set some new facility in
Python 2.4?
©# from Reinhold Birkenfeld
©def merge(pairings):
©sets = {}
©for x1, x2 in pairings:
©newset = (sets.get(x1, frozenset([x1]))
©
I started to collect i believe the 4 or so solutions by different
people... but seems it's gonna take some an hour or more... So far the
only other one i've run and find alright is Reinhold Birkenfeld's
original. Others worth noting i'm aware of is David Epsteinn, improved
versions from Reinhold Bi
another functional exercise with lists.
Here's the perl documentation. I'll post a perl and the translated
python version in 48 hours.
=pod
parti(aList, equalFunc)
given a list aList of n elements, we want to return a list that is a
range of numbers from 1 to n, partition by the predicate funct
# the following solution is submitted by
# Sean Gugler and David Eppstein independently
# 20050224.
@def parti(aList, equalFunc):
@result = []
@for i in range(len(aList)):
@for s in result:
@if equalFunc( aList[i], aList[s[0]] ):
@s.append(i)
@
is there a way to write a expression of a function with more than 1
argument?
e.g., i want a expression that's equivalent to
def f(x,y)
return x+y
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-02-26, bruce <[EMAIL PROTECTED]> wrote:
> hi...
>
> i'm running rh8.0 with gnome.. i'm not sure of the version (it's whatever rh
> shipped).
>
> i've recently updated (or tried to update) python to the latest version.
> when i try to run the 'Server Settings/Services' Icon within gnome, not
lambda x, y: x + y
that's what i was looking for.
... once i have a lambda expr, how to apply it to arguments?
e.g. in Mathematica
Function[#1+#2][a,b]
Python doc is quite confounded in it's way of organization centered
around implementation tied to hardware (as most imperative languages
are ha
folks:
when using google to post a reply, it sometimes truncates the subject
line. i.e. [perl-python] is lost. This software error is obvious, they
could not have not noticed it.
another thing more egregious is that google _intentionally_ edit with
people's posts. (e.g. they change email address
org/UnixResource_dir/writ/responsible_license.html
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
Xah Lee wrote:
> folks:
>
> when using google to post a reply, it sometimes truncates the subject
> line. i.e. [perl-python] is lost. This software error is obvious,
20050226 exercise: generate all possible pairings
given a list that is a set partitioned into subsets, generate a list
of all possible pairings of elements in any two subset.
Example:
genpair( [[9,1],[5],[2,8,7]] );
returns:
[[5,8],[9,5],[1,5],[9,2],[9,7],[1,8],[1,7],[5,2],[1,2],[9,8],[5,7]]
Answer to the previous exercise.
http://xahlee.org/perl-python/generate_pairings.html
# perl
sub genpair ($) {
my $partiSet = $_[0];
my @result;
for (my $head =0; $head <= ((scalar @$partiSet)-2); $head++ ) {
for (my $tail = $head+1; $tail <= ((scalar @$partiSet)-1); $tail++
) {
foreac
once i have a expresson of a function, how to apply it to arguments?
e.g. if i have
lambda x,y:x+y
i have to applied it to a,b in my code.
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
Roel Schroeven wrote:
> (lambda x, y: x+y)(a, b)
Thanks. That's what i was looking for.
where in Pytho doc can one find this? or the lambda with multiple
params?
> Most often the lambda is not used directly, but passed to a function.
That is because the IT morons has been throughly brainwashe
PS sorry for the rude remarks out of nowhere.
Xah
--
http://mail.python.org/mailman/listinfo/python-list
if i understand correctly, forms such as
(lambda x,y:x+y)(a,b)
can only be gained thru experience? and not documented directly
anywhere in the official docs?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
i have a bunch of files encoded in GB18030. Is there a way to convert
them to utf16 with python?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
is it possible in Python to create a function that maintains a variable
value?
something like this:
globe=0;
def myFun():
globe=globe+1
return globe
apparently it can't be done like that. I thought it can probably be
done by prefixing the variable with some package context...
the Python doc
On 2005-03-06, Stewart Midwinter <[EMAIL PROTECTED]> wrote:
> I've got an app that creates an object in its main class (it also
> creates a GUI). My problem is that I need to pass this object, a
> list, to a dialog that is implemented as a second class. I want to
> edit the contents of that list a
Truely superb!
Thanks!
Xah
[EMAIL PROTECTED]
http://xahlee.org/
[EMAIL PROTECTED] wrote:
> Xah Lee <[EMAIL PROTECTED]> wrotE:
>
> > i have a bunch of files encoded in GB18030. Is there a way to
convert
> > them to utf16 with python?
>
> You will need CJKCod
thanks for the help...
---
the python doc is stilted. It tried to organized the thing and with a
style around some highbrow inane "computer science" outlook.
i found the little section on global
(http://python.org/doc/2.4/ref/global.html)
and can't make out what shit it is trying to say with
>def myFun(var):
> return var+1
>globe = 0
>globe = myFun(globe)
this is intriguing. How does it work?
not a rhetorical question, but where in the python doc can i read about
it?
thanks.
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listi
Nevermind. I was thinking too much. :) Thanks.
Xah
Peter Hansen wrote:
> Xah Lee wrote:
> >>def myFun(var):
> >> return var+1
> >>globe = 0
> >>globe = myFun(globe)
> >
> > this is intriguing. How does it work?
> > not a rhetoric
here's a large exercise that uses what we built before.
suppose you have tens of thousands of files in various directories.
Some of these files are identical, but you don't know which ones are
identical with which. Write a program that prints out which file are
redundant copies.
Here's the spec.
On 2005-03-11, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello NG,
>
>I am still quite a newbie with Python (I intensely use wxPython, anyway).
> I would like to know what are, in your opinions, the best/faster databases
> that I could use in Python (and, of course, I should be able to "li
On 2005-03-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello, I'm new to both PostgreSQL and psycopg and I'm trying to connect
> to my database running on localhost. I have postgres setup to do md5
> authentication and this works when using a db admin tool on my local
> network. For some rea
On 2005-03-14, Joe <[EMAIL PROTECTED]> wrote:
> On Sun, 13 Mar 2005 19:20:34 +0100, "Diez B. Roggisch"
><[EMAIL PROTECTED]> wrote:
>>Plain wrong. You can access them via FTP and WEBDAV.
>
> Not wrong. I am aware of this, but it's not like that many development
> tools can work through FTP or WebDav
this url:
http://www.python.org/doc/2.4/
sayz:
Python 2.4 Documentation (released November 30, 2004)
but this url:
http://www.python.org/doc/2.3.5/
sayz:
Python 2.3.5 Documentation (released February 8th, 2005)
so, python 2.3.5 is released about 2 months later than 2.4??
also, does the "rele
python has this nice unicodedata module that deals with unicode nicely.
#-*- coding: utf-8 -*-
# python
from unicodedata import *
# each unicode char has a unique name.
# one can use the âlookupâ func to find it
mychar=lookup('greek cApital letter sIgma')
# note letter case doesn't matter
print
how do i get a unicode's number?
e.g. 03ba for greek lowercase kappa? (or in decimal form)
Xah
Xah Lee wrote:
> python has this nice unicodedata module that deals with unicode
nicely.
>
> #-*- coding: utf-8 -*-
> # python
>
> from unicodedata import *
>
> # each u
ode?
By the way - is there a good way to find out the maximum memory a program
used (in the manner of the "time" command)? Other than downloading and
running the shootout benchmark scripts, of course.
--
Jacob Lee
[EMAIL PROTECTED] | www.nearestneighbor.net
--
http://mail.python.org/mailman/listinfo/python-list
uirements. What if your last line is less than 60
characters long? You no longer will be displaying the input in reverse
order. Otherwise you'd be right - my solution would be unnecessarily
unwieldy (and the problem would be much simpler...) .
--
Jacob Lee
[EMAIL PROTECTED] | www.nearestneighbor.net
--
http://mail.python.org/mailman/listinfo/python-list
'TGVHCDM\nKNSYAAWBRTGVHCDMKNSYAAWBR')):
seq = seq.translate(table)[::-1]
for i in range(0, len(seq), 60):
print seq[i:i+60]
def main():
seq = []
for line in sys.stdin:
if line[0] in ';>':
show(''.join(seq))
print line,
del seq[:]
else:
seq.append(line[:-1])
show(''.join(seq))
main()
--
Jacob Lee
[EMAIL PROTECTED] | www.nearestneighbor.net
--
http://mail.python.org/mailman/listinfo/python-list
, '|', name(x,'-')
--
http://xahlee.org/perl-python/unicodedata_module.html
anyone wants to supply a Perl version?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
Brian McCauley wrote:
> Xah Lee wrote:
>
> > i don't know what's the state of Perl's unicode.
>
> perldoc perlunicode
--
http://mail.python.org/mailman/listinfo/python-list
Fuck google incorporated for editing my subject name without
permission.
and fuck google incorporated for editing my message content without
permission.
http://xahlee.org/UnixResource_dir/writ/responsible_license.html
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://
>
> This is my shorter and faster version of Harmonic (I hope the use of
> sum instead of the for is okay for the Shootout rules):
> http://shootout.alioth.debian.org/benchmark.php?test=harmonic&lang=python&id=0&sort=fullcpu
>
> import sys
> print sum(
On 2004-12-08, Tony Pryor <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Anyone know if running two client telnet sessions at the same time
> should be an inherent problem? They don't seem to want to share a port
> or are they trying to use the same console for interaction with the
> connected servers?
>
401 - 500 of 1695 matches
Mail list logo