Carl,
First off - Thanks your post was exactly the kind of informative
example driven learnings that help — Thanks!!
On Oct 22, 9:05 pm, Carl Banks wrote:
>
> Before we get into object semantics, I'm not sure why you'd need to
> override __new__ for Borg pattern, unless they're working around
Hi all,
I have a basic Monostate with Python 2.6.
class Borg(object):
__shared_state = {}
def __new__(cls, *args, **kwargs):
self = object.__new__(cls, *args, **kwargs)
self.__dict__ = cls.__shared_state
return self
def __init__(self, *args, **kwargs):
Hi Geniuses,
Can anyone please show me the way.. I don't understand why this
doesn't work...
# encoding: utf-8
from email.MIMEText import MIMEText
msg = MIMEText("hi")
msg.set_charset('utf-8')
print msg.as_string()
a = 'Ho\xcc\x82tel Ste\xcc\x81phane '
b = unicode(a, "utf-8")
print b
msg =
On Jun 9, 4:58 pm, David Lyon wrote:
> On Tue, 9 Jun 2009 16:30:06 -0700 (PDT), rh0dium
> wrote:
>
> >> > Apparently there is a problem with the if statement???
>
> >> > Thanks
>
> > No for .pth files this needs to be on a single line..
>
&g
On Jun 9, 9:19 pm, alex23 wrote:
> On Jun 10, 8:00 am, rh0dium wrote:
>
> > Apparently there is a problem with the if statement???
>
> Try restructuring the if as a ternary condition:
>
> import os, site; smsc = os.environ.get("TECHROOT", "/home/tech"
On Jun 9, 3:28 pm, Emile van Sebille wrote:
> On 6/9/2009 3:00 PM rh0dium said...
>
>
>
>
>
> > I have a .pth file which has some logic in it - but it isn't quite
> > enough...
>
> > It started with this..
> > import os, site; site.addsitedir(os.p
I have a .pth file which has some logic in it - but it isn't quite
enough...
It started with this..
import os, site; site.addsitedir(os.path.join(os.environ["TECHROOT"],
"tools/python/modules"))
But that eventually evolved into..
import os, site; site.addsitedir(os.path.join(os.environ.get
("TECH
On Jan 9, 3:42 pm, Robert Kern wrote:
> Christian Heimes wrote:
> > rh0dium schrieb:
> >> Hi All,
>
> >> Can someone tell me how to redirect stderr back to the console once
> >> you've moved it?
>
> > sys.stderr = sys.__stderr__
&g
On Jan 9, 3:52 pm, Christian Heimes wrote:
> Robert Kern schrieb:
>
>
>
> > Christian Heimes wrote:
> >> rh0dium schrieb:
> >>> Hi All,
>
> >>> Can someone tell me how to redirect stderr back to the console once
> >>> yo
Hi All,
Can someone tell me how to redirect stderr back to the console once
you've moved it?
import os,sys
se = os.open("/tmp/mod.log", os.O_WRONLY|os.O_APPEND|os.O_CREAT)
sys.stderr.write("Foobar\n")
Foobar
os.dup2(se, 2)
cmds = os.popen("ls alaksjdf")
sys.stderr.write("Foobar\n")
Foobar
An
Hi All,
Can someone tell me how to redirect stderr back to the console once
you've moved it?
import os,sys
se = os.open("/tmp/mod.log", os.O_WRONLY|os.O_APPEND|os.O_CREAT)
sys.stderr.write("Foobar\n")
Foobar
os.dup2(se, 2)
cmds = os.popen("ls alaksjdf")
sys.stderr.write("Foobar\n")
Foobar
An
Hi all,
Perhaps it's not supposed to work like this but I thought if you
supplied a width to pprint it would nicely format a list to the
width.
KEYS = ['search_keys', 'Section', 'site', 'Employee', 'JobClassCode',
'XBoss', 'Department',
'LocationDesc', 'cn', 'Division', 'Fax', 'Secti
Hi all,
I have a primitive data structure which looks like this.
cells = [{'name': 'AND2X1',
'pins': [{'direction': 'input', 'name': 'A', 'type':
'signal'},
{'direction': 'input', 'name': 'B', 'type':
'signal'},
{'direction': 'output', '
Hi all,
I almost did my first pyparsing without help but here we go again.
Let's start with my code. The sample data is listed below.
# This will gather the following ( "NamedPin" "PinDirection"
"OptionalSignal" )
guts = Group( LPAR.suppress() +
quotedString.setParseAction(removeQuotes).setResul
On Mar 23, 1:48 pm, rh0dium <[EMAIL PROTECTED]> wrote:
> On Mar 23, 12:26 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
>
>
>
> > There are a couple of bugs in our program so far.
>
> > First of all, our grammar isn't parsing the METAL2 entry at all.
On Mar 23, 12:26 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
> There are a couple of bugs in our program so far.
>
> First of all, our grammar isn't parsing the METAL2 entry at all. We
> should change this line:
>
> md = mainDict.parseString(test1)
>
> to
>
> md = (mainDict+stringEnd).pars
On Mar 22, 6:30 pm, Paul McGuire <[EMAIL PROTECTED]> wrote:
> Oof, I see that you have multiple "Layer" entries, with different
> qualifying labels. Since the dicts use "Layer" as the key, you only
> get the last "Layer" value, with qualifier "PRBOUNDARY", and lose the
> "Layer" for "METAL2". To
Hi all,
I am struggling with parsing the following data:
test1 = """
Technology {
name= "gtc"
dielectric = 2.75e-05
unitTimeName= "ns"
timePrecision
Hi all,
I have a simple list to which I want to append another tuple if
element 0 is not found anywhere in the list.
element = ('/smsc/chp/aztec/padlib/5VT.Cat',
'/smsc/chp/aztec/padlib',
'5VT.Cat', (33060))
element1 = ('/smsc/chp/aztec/padlib/5VT.Cat2',
'/smsc/chp/aztec/padlib',
'5VT.
Hi all,
I need some help on writing a recursive priority function
Given a list = [ A, B, C, D]
Where the following constraints are in place:
A depends on [B, C]
C depends on [B]
Figure out real order that prioritizes these.
Output [ B, C, A, D ] is valid. (Actually D could be anywhere in it
Hi all,
I am thinking about a class which can automatically determine the
order which it is run. I would like to implement a super class which
has a run() method and a pretrigger() method. The purpose of the
pretrigger method is to state what classes need to be run before this
class.run() method
On Sep 6, 10:55 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> On Sep 6, 6:26 pm, rh0dium <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I have the following piece of code and I wanted to set the default
> > attributes based on a dictionary. Wha
Hi all,
I have the following piece of code and I wanted to set the default
attributes based on a dictionary. What I am looking for is a way to
take PIPODEFAULTS and assign each one as an attribute for the class
pipo. Can someone show me how to do this by iterating over the
PIPODEFAULTS and assign
On Jul 9, 1:19 pm, rh0dium <[EMAIL PROTECTED]> wrote:
Hi all,
OK so I've started re-writing this based on the feedback you all gave
me. How does this look?
class Scanner:
def __init__(self, *args, **kwargs):
"""description"""
On Jul 9, 9:59 am, Paul McGuire <[EMAIL PROTECTED]> wrote:
> I believe the OP is talking about "interface" as in "hardware
> interface", using some form of serial communication. His example does
> not use pyserial, but it does refer to a "UnidenConnection" class,
> with parameters such as bitrate,
erface example? I think we both can agree that
fundamentally this is pretty simple but I want to do it right and an
solid class example of interface programming would be nice.
Thanks
rh0dium
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
I got this new radio scanner (toy!!) this weekend and I can access it
via a serial cable. I want to write a interface around it but I am
looking for some suggestions. I thought at first I would simply class
the Scanner and write the various methods as attibutes similar to
below.. But the
On May 2, 8:25 am, Gary Herron <[EMAIL PROTECTED]> wrote:
> rh0dium wrote:
> >> This is far more work than you need. Push an (args, kwargs) tuple into
> >> your arguments queue and call self.function(*args, **kwargs).
>
> > No see I tried that and that won'
On May 2, 7:49 am, Bruno Desthuilliers wrote:
> Yes - using inspect.getargspec. I don't have example code at hand yet,
> but it's not really complicated.
Viola!! Hey this works!! Now I have modified my code to do this - way
cool (still kind of a mess though)
args, varargs, varkw, d
> This is far more work than you need. Push an (args, kwargs) tuple into
> your arguments queue and call self.function(*args, **kwargs).
No see I tried that and that won't work.
I'm assuming what you are referring to is this (effectively)
Q.put(((),{a:"foo", b:"bar}))
input = Q.get()
self.funct
Hi all,
Below is a basic threading program. The basic I idea is that I have a
function which needs to be run using a queue of data. Early on I
specified my function needed to only accept basic parameters ( no
postional *args or *kwargs ) but now I am re-writing it and I want to
accept these. Is
Thanks to all who helped!!
Let me expand a bit more - I am working on a threading class and I
want to be able to push on the Queue a list of args. If you run the
following program - I am failing to understand how to push items onto
the queue in a manner so that func2 recognizes them as kwargs not
Hi Experts!!
I am trying to get the following little snippet to push my data to the
function func(). What I would expect to happen is it to print out the
contents of a and loglevel. But it's not working. Can someone please
help me out.
---
#!/usr/bin/env python
import rand
Hi all,
I am using pexpect to drive another tool. Some of the data I get back
would be better suited as a list and I want to know a simple way to
parse the data to push it into a list.
For example
I get the following string back. I want to convert this to a list:
'("." ".." "cdslib_cleanup.py
On Mar 20, 12:30 pm, Stargaming <[EMAIL PROTECTED]> wrote:
>
> from sys import version_info
> if version_info[0] < 2 or version_info[1] < 4:
> raise RuntimeError("You need at least python2.4 to run this script")
This is great!!
>
> IMO you shouldn't struggle with it too hard. If the user's p
> Python usually installs so the latest version gets linked as
> /usr/bin/python. HTere's no need to bind your scripts to a particular
> version.
>
> regards
True - but that entirely depends on your path. Example:
Redhat (RHEL3) ships with python2.3 in /usr/bin
Adding an 2.5 version to /usr/loc
Hi Folks,
OK I love the logging module. I use it everywhere. I was happily
putting at the top of each of my scripts
#!/usr/bin/env python2.4
import logging
LOGLEVEL=logging.INFO
# Set's up a basic logger
logging.basicConfig(level=LOGLEVEL, format="%(asctime)s %(name)s %
(levelna
Hi all,
I have a directory with a bunch of python classes each uniquely named
such that the file name (dropping .py) is also the class name of the
file in question. So for example
foo.py
class foo:
def __init__(self):
print "Hi I am %s" % self.__class__.__name__
Now I have a bunch of
Hi Folks,
I use p4python for all of my perforce and python related needs. I'm
on a Mac (OSX 10.4). p4python relies on a perforce provided API which
gets compiled when I run the setup.py. The setup.py by default does
not support macs so I figured what better way to spend a night than to
figure o
Hi Maria,
This is exactly what I was looking for. I (as others have asked me to)
cleared my head of the other languages, but was mearly giving perl as
an example indicating the compactness I was after.
Thanks Maria!!
MaR wrote:
> rh0dium wrote:
> > Hi all,
> >
> > So I ha
Hi all,
So I have this simple little routine.. say like this..
def foo()
return {"a":"b", "b":"c"}
if foo():
print "Have foo"
Now I want the dictionary item a (ie. b)
How can I do it the above way or do I still have to go like this..
def foo()
return {"a":"b", "b":"c"}
z = foo()
Hi Nick!
This is much better than the kludge job I did - Thanks for the help!!
Nick Craig-Wood wrote:
> rh0dium <[EMAIL PROTECTED]> wrote:
> > I have a problem with putting a job in the background. Here is my
> > (ugly) script which I am having problems getting to backgr
Hi all,
I have a problem with putting a job in the background. Here is my
(ugly) script which I am having problems getting to background. There
are threads about doing
python script.py &
and others
nohup python script.py &
and yet others
( python script.py > /dev/null & ) &
R
Hi all,
Thanks for the response. Yeah that's what I'm currently doing but I
thought that it would be cleaner for me to append my own location at
compile time. I'm surprised that this doesn't exist..
Thanks.
Avell Diroll wrote:
> rh0dium wrote:
> (snip)
> &g
Hi all,
Can anyone help me out. I would like to have python automatically look
in a path for modules similar to editing the PYTHONPATH but do it at
compile time so every user doesn't have to do this..
Soo...
I want to add /foo/bar to the PYTHONPATH build so I don't have to add
it later on. Is
rh0dium wrote:
It should be noted that these are virtual not real so filecmp can't be
used...
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
OK I have two lists of directories..
Master
lista=["pad/foo/sch/filea","pad/foo/sch/fileb","pad/foo/sch/filec","pad/foo/lay/filea","pad/foo/lay/fileb","pad/foo/lay/filec","pad/bar/sch/filea","pad/bar/sch/fileb","pad/bar/sch/filec",,"pad/bar/lay/filea","pad/bar/lay/fileb","pad/bar/lay/file
ROTFLMAO - Thanks --- I "meant" has anyone done the wrapper approach
before!! Not has anyone used the code.. hahah nice!!
subprocess also has the wait object. I think I like this better than
popen2 (which I have used in the past) for a number of reasons but
primarily it's simplicity. Having sai
Hi all,
Here I was happily coming to working thinking - OK I need to create a
wrapper for a tool (UNIX) which does nothing but lauch the end tool and
send a sql instert letting the db know the tool was launched (Can we
say Big Brother..). Some of the tools are very long running with lots
of data
Hi All,
I have the nice little function (below) which used to work great
assuming the data[key] passed to it was a list. Well now I want to
update this a bit. I want this function to be smart enough to tell if
it's a list and do the funky concatonation otherwise don't.
def insert(self, table
Hi all,
I am trying to parse into a dictionary a table and I am having all
kinds of fun. Can someone please help me out.
What I want is this:
dic={'Division Code':'SALS','Employee':'LOO ABLE'}
Here is what I have..
html=""" Division Code:
SALS Employee:
LOO ABLE """
from Beautiful
Hi all,
Can someone help me out. I am trying to determing for each run whether
or not the test should pass or fail but I can't seem to access the
results ..
Alternatively can someone suggest a better structure ( and a lesson as
to the reasoning ) that would be great too!!
cells={}
cells["NOR3X
Hey thanks - OK how would you arrange the data structure? I think that
is my problem - I can arrange in any order - I just want something
which makes sense - this "seemed" logical but can you point me in a
better method.. Basically I am parsing a directory structure:
TECHROOT/
130nm/
ts
Thanks!!
I got all of this. The problem that I was trying to figure out was
this.
Basically there are multiple combinatories here - I was hoping someone
could point me to a general approach. Writing the actual funtion is
not necessary - as you pointed out I can certainly do that. Here is my
pr
Hi all,
I have a dict which looks like this..
dict={'130nm': {'umc': ['1p6m_1.2-3.3_fsg_ms']},
'180nm': {'chartered': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':
['1p6m_1.8-3.3_sal_log', '1p6m_1.8-3.3_sal_ms']},
'250nm': {'umc': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':
['1p6m_2.2-3.5_sal_log', '1p6m_1.8-3.3_sal_ms'
Hi all,
I am having a bit of difficulty in figuring out an efficient way to
split up my data and identify the unique pieces of it.
list=['1p2m_3.3-1.8v_sal_ms','1p2m_3.3-1.8_sal_log']
Now I want to split each item up on the "_" and compare it with all
others on the list, if there is a difference
Hi all,
Has any of you fine geniuses figured out a nice python script to go to
the Southwest airlines website and check in, and retrieve your boarding
pass - automatically 24 hours in advance
--
http://mail.python.org/mailman/listinfo/python-list
Alex Martelli wrote:
> From this constuct I assume self.sections is a dict, in which case there
> may be better way to loop over the values in the dict; but that's an
> aside and does not affect your stated problem. Rather, said problem is
> already shown in the next couple lines:
>
> >
Hi all,
Why doesn't this work as expected.. I expect that the the lines within
the sections will get modified - permanently. It is modifying them
during the first section but they never get saved to the new values..
Can anyone help me and even better explain why it's not working..
for
Hi all,
I need a cleaner ( and shorter ) way to to look in my home directory or
any directory for a directory called modules. This is what I currently
have - but it is really ugly. Some a few of you experts point me to a
cleaner more pythonic approach?
mod = 0
if os.path.exists( o
Hi all,
I have a file which I need to parse and I need to be able to break it
down by sections. I know it's possible but I can't seem to figure this
out.
The sections are broken by <> with one or more keywords in the <>.
What I want to do is to be able to pars a particular section of the
fil
Michael Spencer wrote:
> >>> def parse(source):
> ... source = source.splitlines()
> ... original, rest = source[0], "\n".join(source[1:])
> ... return original, rest_eval(get_tokens(rest))
This is a very clean and elegant way to separate them - Very nice!! I
like this alot -
Paul McGuire wrote:
> ident = Combine( Word(alpha,alphanums+"_") + LPAR + RPAR )
This will only work for a word with a parentheses ( ie. somefunction()
)
> If you *really* want everything on the first line to be the ident, try this:
>
> ident = Word(alpha,alphanums+"_") + restOfLine
> or
> ide
Paul McGuire wrote:
> -- Paul
> (Download pyparsing at http://pyparsing.sourceforge.net.)
Done.
Hey this is pretty cool! I have one small problem that I don't know
how to resolve. I want the entire contents (whatever it is) of line 1
to be the ident. Now digging into the code showed a method
Hi all,
I am using python to drive another tool using pexpect. The values
which I get back I would like to automatically put into a list if there
is more than one return value. They provide me a way to see that the
data is in set by parenthesising it.
This is all generated as I said using pexpec
", "loghost", "timehost", "mailhost" ]
for host in hosts:
sn = re.split( "\.", host)
if not sn[0] in ignore:
e.append(host)
ignore.append(sn[0])
print e
But this STILL gives me some problems..
['poundcake.nsc.com', 'scor
Hi all,
Ok I have a list
hosts = [ "poundcake.fqdn.com", "scorpion.fqdn.com", "loghost",
"scorpian", "localhost", "lan", "lan.fpdn.com" ]
Assumptions:
scorpian.fqdn.com == scorpian
lan == lan.fqdn.com
I want pear this list down based on the following:
1. ignore loghost, localhost, timehost, ma
child.tochild.close()
child.fromchild.close()
return out,results
Comments..
rh0dium wrote:
> Paul Rubin wrote:
> > "rh0dium" <[EMAIL PROTECTED]> writes:
> > > Thanks much - Alternatively if anyone else has a better way to do what
> > > I am
Paul Rubin wrote:
> "rh0dium" <[EMAIL PROTECTED]> writes:
> > Thanks much - Alternatively if anyone else has a better way to do what
> > I am trying to get done always looking for better ways. I still want
> > this to work though..
>
> You don'
Hi all,
Another newbie question. So you can't use signals on threads but you
can use select. The reason I want to do this in the first place it I
need a timeout. Fundamentally I want to run a command on another
machine, but I need a timeout. I have to do this to a LOT of machines
( > 3000 ) an
Slight correction..
rh0dium wrote:
> Hi all,
>
> Still a newbie but making some headway. So I have a file structure
> like this..
>
> top/
> --modules/
> metrics.py
> --metrix/
> uptime.py
>
> Now metrics.py is my superclass, and uptime.py inherits the
Hi all,
Still a newbie but making some headway. So I have a file structure
like this..
top/
--modules/
metrics.py
--metrix/
uptime.py
Now metrics.py is my superclass, and uptime.py inherits the superclass
metrics.py.
So for arguments sake
metrics.py
class metrics():
Hi all,
I don't understand the signal module. I guess I understand what it
does in principle but I can't figure out how to use it to timeout an
external rsh command after a 5 seconds. Does anyone know how to do
this.
Here is what I have so far - which is largely based on the example on
the man p
Peter Otten wrote:
> rh0dium wrote:
>
> > for mod in modules:
> > a = mod.mod()
> > a.run()
>
> Puzzle: If mod.mod did what you expect, what would a.run have to do to
> maintain consistency?
I thought that once a = example.example the class is then loa
I found my problem it wasn't this piece of the problem it was
another...
Thanks.
However if you want a working example go here..
http://www.onlamp.com/pub/a/python/2005/06/02/logging.html
--
http://mail.python.org/mailman/listinfo/python-list
2.example2()
a.run()
etc.
So how is the substitution not working??
Robert Kern wrote:
> rh0dium wrote:
> > Hi all,
> >
> > Basically I have a bunch of pluggins in a directory (METDIR). For each
> > one of these templated pluggins I want to do a specific routine.
Hi all,
Basically I have a bunch of pluggins in a directory (METDIR). For each
one of these templated pluggins I want to do a specific routine. Let's
start with a basic template
file example1.py
class example1:
def __init__(self):
print "Initialize"
def run(self):
Hi all,
So I have a slice of code which calls other python code. I have
started to take a real liking to the logging module, but I want to
extend this into the called python code. I have no idea how to pass
the handle from the calling code into the modules..
So basically here is what I do..
--
Hi all,
I have a script which appears to work but it errors and the following
output is given. My code is listed below..
Traceback (most recent call last):
File "./ldap-nsc2.py", line 96, in ?
truc.search()
File "./ldap-nsc2.py", line 49, in search
(result_type, result_data) = cnx.re
Hi
I really like your approach but when do you actually get connected??
You never call the method connect?
>
> class NSCLdap(object):
> def __init__(self,
> server="sc-ldap.nsc.com",
> baseDN="o=nsc.com",
> who=None,
>
Thanks Bruno!!
Very much appreciated the modifications!!
Bruno Desthuilliers wrote:
> rh0dium a écrit :
> > Hi all,
> >
> > I believe I am having a fundamental problem with my class and I can't
> > seem to figure out what I am doing wrong. Basically I want
I knew it had to be something obvious - thanks so much!!
John Machin wrote:
> rh0dium wrote:
> > Hi all,
> >
> > I believe I am having a fundamental problem with my class and I can't
> > seem to figure out what I am doing wrong. Basically I want a class
> &
Hi all,
I believe I am having a fundamental problem with my class and I can't
seem to figure out what I am doing wrong. Basically I want a class
which can do several specific ldap queries. So in my code I would have
multiple searches. But I can't figure out how to do it without it
barfing..
Th
Try this..
#!/usr/bin/env python
# Upload a file to a FTP server
from sys import argv, exit
from ftplib import FTP
if len(argv) != 6:
print 'Incorrect number of parameters'
print 'USAGE: upload.py
'
exit(0)
server = argv[1]
username = argv[2]
password = argv[3]
upfile = argv
Hi all,
I am starting to play with pysqlite, and would like to know if there is
a function to determine if a table exists or not.
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
I am having a problem with the method cpuNum. Basically I look to see
if the "flag" for "ht" is enabled. If it is the total processors
should be cpucount/2. It's not working. I can't seem to get into the
second re.match. Can someone point out my apparent error?
class Sysinfo:
def
Fredrik Lundh wrote:
> didn't you ask the same question a few days ago? did you read the
> replies to that post?
Yes I did but the XML was malformed.. Actually it still is but you
helped me figure out a way to correct it - Thanks
Here is what I have so far. Now I want to find a child of a chi
Hi all,
I am relatively new to python and certainly new to XML parsing. Can
some show me how to get the product text out of this? Really I want to
know this has 2 processors and the are AMD Opteron(tm) Processor 250
I have gotten this far...
class HWParser:
def __init__(self):
if
HI all,
I am looking to parse a unix tool called lshw (
http://ezix.sourceforge.net/software/lshw.html ). Now this provides a
nice XML output which looks similar to the bottom of this message..
Now I want to parse and get some information from it so here is what I
have..
class HWParser:
def
Now can you reverse this process tuple2coord??
Thats what I'm really after :)
--
http://mail.python.org/mailman/listinfo/python-list
Wow - now that is ugly.. But it is effective. I would love a cleaner
version - but I did say brevity :)
Nice work.
--
http://mail.python.org/mailman/listinfo/python-list
Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'sorted' is not defined
I think you're probably using 2.4 ??
--
http://mail.python.org/mailman/listinfo/python-list
This is great but backwards...
Ok because you all want to know why.. I need to convert Excel columns
A2 into , [1,0] and I need a simple way to do that..
( The way this works is A->0 and 2->1 -- Yes they interchange -- So
B14 == [13,1] )
So my logic was simple convert the A to a number and the
Call me crazy.. But it doesn't work..
for i, digraph in enumerate(sorted([''.join((x, y)) for x in alpha for
y in [''] + [z for z in alpha]], key=len)):
globals()[digraph]=i+1
How do you implement this sucker??
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Hi All,
While I know there is a zillion ways to do this.. What is the most
efficient ( in terms of lines of code ) do simply do this.
a=1, b=2, c=3 ... z=26
Now if we really want some bonus points..
a=1, b=2, c=3 ... z=26 aa=27 ab=28 etc..
Thanks
--
http://mail.python.org/mailman/listinfo/p
95 matches
Mail list logo