I'd start with something like this:
final_result = []
for data, target in zip(f, t):
a, b = [elem.strip() for elem in line.split()]
c = target.strip()
final_result.append([[a, b], [c]])
Though I'm not sure why you have the "result" data in single element lists.
--
I enjoy haiku
but s
I am facing the same problem that little complicated.
I have this kind of data in a file and actually it's coming from another class
and it's in formex:0 00 11 01 1and another data which it's in form :0110so now
what I need to put it in form data= [[[0,0],[0]], [[0,1],[1]],
[[1,0]
On Mon, 24 May 2010 03:06:28 am Wayne Werner wrote:
> On Sat, May 22, 2010 at 9:58 AM, Steven D'Aprano
wrote:
> > On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> > > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
> >
> > wrote:
> > > > Why do people keep recommending Decimal? Decimals suff
Hey Alex,
What's happening is that you're still in "defining functions" mode on the
line
def doSomething(self, arg3=self.arg1):
self, which is really nothing more than a parameter being passed in (special
parameter, but a parameter none the less) hasn't been assigned a value yet.
Imagine this f
"Alex Hall" wrote
class c(object):
def __init__(self, arg1, arg2):
self.arg1=arg1
self.arg2=arg2
def doSomething(self, arg3=self.arg1):
...
The above results in an error that "name 'self' is not defined". Why
can I not set the default values of a method's arguments to class
vars
like th
Hello all,
I know Python reasonably well, but I still run into basic questions
which those over on the other python list request I post here instead.
I figure this would be one of them:
Why would this not work:
class c(object):
def __init__(self, arg1, arg2):
self.arg1=arg1
self.arg2=arg2
d
On Sat, May 22, 2010 at 9:58 AM, Steven D'Aprano wrote:
> On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote:
> > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano
> wrote:
> > > Why do people keep recommending Decimal? Decimals suffer from the
> > > exact same issues as floats,
> >
> > This is exa
On 05/22/10 22:32, Steven D'Aprano wrote:
> On Sat, 22 May 2010 07:16:20 am wesley chun wrote:
>> correct, it is a floating point issue regardless of language.. it's
>> not just Python. you cannot accurately represent repeating fractions
>> with binary digits (bits). more info specific to Python he