Thanks, got it.
"M.E.Farmer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > If I have:
> >
> > a = (1,2,3)
> >
> > how do I ended up with:
> >
> > res=[(1), (2), (3), (4), (5)]
>
; <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > If I have:
> >
> > a = (1,2,3)
>
> Note that this is a tuple.
>
> > how do I ended up with:
> >
> > res=[(1), (2), (3), (4), (5)]
>
> Not that this
If I have:
a = (1,2,3)
how do I ended up with:
res=[(1), (2), (3), (4), (5)]
without doing:
res=[(a[0]), (a[1]), (a[2]), (4), (5)]
???
ps: This is just a nobrainer example of what my real code is trying to do.
"a" might have many many elements. That's why the explicit indexing
No, those are old still.
"Deltones" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > As stated in the on-line WalkThrough, the information there was written
for
> > an older version of the program.
> >
>
>
> Hi,
>
> I understand, but the walkthrough I'm doing comes from the doc fo
As stated in the on-line WalkThrough, the information there was written for
an older version of the program.
"Deltones" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> I'm just getting into Python/wxPython/Pythoncard and I'm trying the
> tutorial from this page:
> http:/
It's:
from PythonCard.components import radiogroup
not just:
from PythonCard import radiogroup
"PipedreamerGrey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm trying to create a standalone version (.exe) of PythonCard's Custdb
> sample using Py2Exe version 0.5.0. E
I've built a Python application using PythonCard 1.9 and Python 2.3 running
under Windows XP. Everything works except that when I use the keyboard
instead of the mouse to do certain operations in a data entry field (like
Shift-Home), the
program stops at line 1014 of wx-2.5.3-msw.ansi\wx\_core.py
Say again???
"Reinhold Birkenfeld" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> It's me wrote:
> > Sorry if my question was a little "lazy" and yes, I was asking about the
> > "lazy evaluation". :=)
> >
>
Thanks.
May be flatten should be build into the language somehow
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "It's me" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Okay, I give up.
> &
return len([(i,x) for i, x in enumerate(flatten(data))])
data = [[1,5,2],8,4]
print count_item(data)
Thanks everybody.
"Mark McEahern" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
>
> >Okay, I give up.
> >
> >
= {}
for i, x in enumerate(flatten(data)):
val_to_pos[x] = i + 1
print val_to_pos
"It's me" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Okay, I give up.
>
> What's the best way to count number of items in a list?
>
> For instance,
&g
Something to keep in mind. :-(
"harold fellermann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> On 12.01.2005, at 18:35, It's me wrote:
>
> > For this code snip:
> >
> > a=3
> >
> > b=(1,len(a))[isinstance(a,(
I tried this and I got:
[(1, 'a'), (2, 'b'), (3, 'c')]
But if I change:
a=[1,2]
I got:
[(1, 'c')]
Why is that? I thought I should be getting:
[(1, 'a'),(2,'b')]
?
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> zip or izip is your friend:
>
> import i
Okay, I give up.
What's the best way to count number of items in a list?
For instance,
a=[[1,2,4],4,5,[2,3]]
I want to know how many items are there in a (answer should be 7 - I don't
want it to be 4)
I tried:
b=len([x for y in a for x in y])
That doesn't work because you would get an iterat
For this code snip:
a=3
b=(1,len(a))[isinstance(a,(list,tuple,dict))]
Why would I get a TypeError from the len function?
Thanks,
--
http://mail.python.org/mailman/listinfo/python-list
path before with C++ and Modelica.
It gets ugly.
Anyway.
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Op 2005-01-12, It's me schreef <[EMAIL PROTECTED]>:
> >
> > "Robert Kern" <[EMAIL PROTECTED]> w
"Robert Kern" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> That's *it*.
So, how would you overload an operator to do:
With native complex support:
def twice(a):
return 2*a
print twice(3+4j), twice(2), twice("abc")
Let's presume for a moment that complex is *not* a nati
You are focusing on computational type applications of complex numbers. For
those, you can do it with any languages - including machine language. It's
just a matter of how much headache you want.
For instance, when constructing "software lego parts" (such as the
Matlab/Simulink type), it's very
"Big and Blue" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> >
> > I am very happy that Python included *native* complex
number
> > support.
>
> And I have always been happy that FORTRAN suppo
Operator overloading (and function overloading) helps but not enough.You
have to be aware of the complex type *everywhere* you go and that's very
annoying and error prone. I've been the works with C++, and later with
Modelica. I am very happy that Python included *native* complex number
supp
For those of us that works with complex numbers, having complex number as a
natively supported data type is a big advantage. Non-native add-ons are not
sufficient and lead to very awkward program code.
"Jürgen Exner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> [EMAIL PROTECTED]
> z = [i + (2, -2)[i % 2] for i in range(10)]
But then why would you want to use such feature? Wouldn't that make the
code much harder to understand then simply:
z=[]
for i in range(10):
if i%2:
z.append(i-2)
else:
z.append(i+2)
Or are we trying to write a book on "Puzz
What does it mean by "stability in sorting"?
Can somebody please give a sample for using the code posted? I am a little
lost here and I like to know more about the use of keys
Thanks,
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Jeff Shannon wrote:
> > I supp
Okay, thanks. That helps a lot.
"Mike Thompson" wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > Yes, Mike,
> >
> > Others pointed that out as well.
>
> For good reason.
>
> >
> > The difficulty is that they are all in VB
and viola! No mentioning
of that anwhere
Would be nice if there's a Python specific of itbut just dreaming...
Back to reading MSDN.
Thanks,
"Mike Thompson" wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > I followed the example in
> >
Thanks,
"David Bolen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "It's me" <[EMAIL PROTECTED]> writes:
>
> > Yes, I read about that but unfortunately I have no experience with VBA
*at
> > all*. :=(
>
> You don't
"Marten Bauer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I did it yesterday like this way and it works well (part of my code):
>
> wb.Worksheets.Add(Count=nrMonths,After=wb.Worksheets(1))
>
> As I read in MSDN you could not write After="sheet1" instead you must
> use th
Ah, this work:
self.xlbook.Worksheets.Add(None,sht)
got it from:
http://mail.python.org/pipermail/python-list/2003-September/183367.html
Thanks again.
--
Me
"It's me" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Kartic" <[EMAIL PR
"Kartic" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am not sure about this but I believe you can give a parameter
> after="sheet1". to Add(), like so, Add(after="sheet1").
>
I get a "got an expected keyword argument 'after'" from Add().
> Unfortunately I do not have Excel in
I followed the example in
http://stompstompstomp.com/weblog/technical/2004-05-20 and learned that to
add a new worksheet to an Excel workbook, you would use the
workbook.Worksheets.Add() method. That works. However, the new worksheet
got added *in front* of the last worksheet I was at. How ca
Thanks, Jeff.
That works.
"Jeff Shannon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
>
> > In my case, there is *no* error message of any kind. When I run
pythonw.exe
> > from the python23 directory, the screen blinked sl
In my case, there is *no* error message of any kind. When I run pythonw.exe
from the python23 directory, the screen blinked slightly and goes back to
the command prompt.
"Jeff Shannon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> DavidHolt wrote:
>
> > I have a problem that I see
Thanks for the reply. I will chew on this a bit.
"Kartic" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> 1. Put your COM invokations in a try/except loop. From my experience,
> that helped me prevent, in most cases, Excel from "hanging" and having
> to restart the PC too. I
I've been using the win32com module with very good success in placing data
onto an Excel spreadsheet. However, whenever I have an error in my script
(like mapping a non-square array onto the spreadsheet), something breaks.
After fixing my error and restart the Python program again, Excel would
sta
I am running 2.3 and it's doing the same thing on my computer - except that
I can't even get it to start from the command prompt.
It used to work but after I switched back and forth between 2.3, and 2.4 and
somewhere in between, it stopped working.
I hope somebody on the list would have a clue ho
What's "LBYL"? Oh...Look-before-you-leap. OK.
I think I understand what's going on now (I read up on generator and
iterators and my head still hurts). I knew there must be a cleaner way of
"walking" around in Python. I will experiment with generator more.
Thanks everybody.
"Jp Calderone" <[
an" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > Another newbie question.
> >
> > There must be a cleaner way to do this in Python:
> >
> > section of C looking Python code
> > a = [[1,5,2], 8, 4]
Another newbie question.
There must be a cleaner way to do this in Python:
section of C looking Python code
a = [[1,5,2], 8, 4]
a_list = {}
i = 0
for x in a:
if isinstance(x, (int, long)):
x = [x,]
for w in [y for y in x]:
i = i + 1
a_list[w] = i
print a_
Well, now that they are API based, they can easily add any script language
they so wish through SWIG (www.swig.org).
Maybe not LISP. SNOBOL would be the right thing to do. (*NOT*)
"Richards Noah (IFR LIT MET)" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> > It was actually
"Richards Noah (IFR LIT MET)" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Begging your pardon, but a better resource would be the brochure available
> (http://www.pti-us.com/PTI/company/brochures/PSSE.pdf). It appears that
the
> program was probably (originally) written in C/C
Shaw-PTI (www.pti-us.com) uses Python in their software. See:
http://www.pti-us.com/pti/news/index.cfm and search "2004 PSS/E User Group
Meeting"
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello All,
> I am trying to convince my client to use Python in his new product. He
> is
And in case it's not obvious already, you get the number of arguments that
got passed down from:
len(args)
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> rbt wrote:
> > How do I set up a function so that it can take an arbitrary number of
> > arguments? For examp
"John Machin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Andrew Dalke wrote:
> > "It's me" wrote:
> > > Here's a NDFA for your text:
> > >
> > >b 0 1-9 a-Z , . + - ' " \n
> >
"Andrew Dalke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "It's me" wrote:
> > Here's a NDFA for your text:
> >
> >b 0 1-9 a-Z , . + - ' " \n
> > S0: S0 E E S1 E E E S3 E S2 E
> &
to hire a programmer to write some clean Python parsing code.
:-)
--
It's me
"Freddie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Happy new year! Since I have run out of alcohol, I'll ask a question that
I
> haven't really worked out an answ
Oops!
Sorry, didn't realize that.
Thanks,
"M.E.Farmer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> It's me wrote:
> > The shlex.py needs quite a number of .py files. I tried to hunt down
> a few
> > of them and got really tire.
The shlex.py needs quite a number of .py files. I tried to hunt down a few
of them and got really tire.
Is there one batch of .py files that I can download from somewhere?
Thanks,
"M.E.Farmer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello me,
> Have you tried shlex.py it
I'll chew on this. Thanks, got to go.
"Steve Holden" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
>
> > I am never very good with regular expressions. My head always hurts
> > whenever I need to use it.
> >
>
"Premshree Pillai" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It certainly is not because Python is bad or something. Organizations
> typically take lot of time to change -- be it technology or office
> furniture.
>
In our industry, the code for the bread and butter tool hasn'
"Steve Holden" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Well the basic idea is "treat what you've been passed as though it is
> the type you wanted". When it's only you writing the code that's likely
> going to be the case. When it's others, you have to be a little more
> care
hread swithing time is only a few machine instructionsOT.OT.
"David Bolen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "It's me" <[EMAIL PROTECTED]> writes:
>
> > It depends on what "help" means to you. Both Windows and
I am never very good with regular expressions. My head always hurts
whenever I need to use it.
I need to read a data file and parse each data record. Each item on the
data record begins with either a string, or a list of strings. I searched
around and didn't see any existing Python packages tha
s why I am struggling to learn about this.
It's hard to writing a routine and not thinking what kind of parameters will
be passed down from above. In the old days, we go out of the way to do that
so programs don't fail in mysterous ways.
"Steve Holden" <[EMAIL PROTECTED]>
pyro is most intriguing! Thanks for the information.
"Anand" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I haven't but one of my friends have used Pyro (Python Remote Objects)
> to do so.
>
> You basically need to write a custom Pyro server and run it on a
> central machine. You
Okay, Nick, I didn't know you can pass a "Class" rather then an instance. I
have to chew on what your example does.
But no, I want to pass an instance of a Class. But how do I know that the
calling routine *did* pass me a class - pardon me: an instance of a Class?
--
It's m
"Gurpreet Sachdeva" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> So That means blindly using threads on any process won't help!
>
It depends on what "help" means to you. Both Windows and Unix (and it's
variances) are considered "thread-weak" OSes. So, using thread will come
Nicolas,
Thanks for the response. Please see comment below.
"Nicolas Fleury" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > an_instance=Abc()
>
> > But what good is that? Of course I know Abc is a class, why would I
want to
> > inspect it so that it would tell me what I already
I haven't play with the thread stuff in Python (yet) but in general terms
(from a C mind), one should not expect read/write actions to be sequential
across threads. I would assume the Python threads eventually goes back to
some system calls for thread handling. If that were the case, you should
Assuming your program is written in C/C++, I would recommend that you start
with SWIG.
http://www.swig.org
You can play around with that as a start. If later you decided that SWIG is
not for you, you can always do it natively. There are plenty of
information at www.python.org.
"Squirrel Havoc
I discovered the hardway what inspect.isclass() is doing. Consider this no
brainer code:
###
import inspect
class Abc:
def Hello(self):
return
an_instance=Abc()
print inspect.isclass(an_instance)
###
It took me a while to understand how I can get inspect.isclass to return a
True (l
I would not think that a generic deepcopy would work for all cases. An
object can be as simple as a number, for instance, but can also be as
complex as the universe. I can't imagine anybody would know how to copy a
complex object otherthen the object itself.
I always think that a well designed
Thanks, Steve.
So, global is only to within a module (I was afraid of that). Those words
flashed by me when I was reading it but since the word "module" didn't
translate to "file" in my C mind, I didn't catch that.
In that case, you are correct that I have to do an import of file1 in file2.
Not
"Premshree Pillai" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 28 Dec 2004 19:34:36 GMT, It's me <[EMAIL PROTECTED]> wrote:
> > This must be another newbie gotchas.
> >
> > Consider the following sill
This must be another newbie gotchas.
Consider the following silly code, let say I have the following in file1.py:
#=
import file2
global myBaseClass
myBaseClass = file2.BaseClass()
myBaseClass.AddChild(file2.NextClass())
#=
and in file2.py, I have:
#=
global
Rocco, your comment noted.
Okay, I got what I need to know for this issue.
Thanks everybody for your help. I greatly appreciate it.
"Rocco Moretti" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "It's me" wrote:
>
> > No, that was ju
"It's me" <[EMAIL PROTECTED]> wrote in message news:EO6Ad.3296>
> I need to look up and see what:
>
> if not isinstance(arg2, basestring):
>
> does.
>
Okay, I got the idea there.
Now, what if arg2 is not a string but either a number or a bunc
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Yeah, given those constraints, you basically have two options -- check
> for list/tuple (as you have above) or check for str/unicode (as I do
> below). I personally prefer the latter because it seems much more
> l
>
> def abc(arg1, arg2, arg3)
> if isinstance(arg2,(list,tuple)):
> for item in arg2:
> abc(arg1, item)
Typo:
abc(arg1, item, arg3)
> and likewise, I can do:
>
> abc(1,["String 1","String 2"],5)
>
> Am I on the right track?
>
L
)
Am I on the right track?
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > A newbie question.
> >
> > How can I tell from within a function whether a particular argument is a
> > sigular type, or a co
:[EMAIL PROTECTED]
> Quoth "It's me" <[EMAIL PROTECTED]>:
> | A newbie question.
> |
> | How can I tell from within a function whether a particular argument is a
> | sigular type, or a complex type?
> |
> | For instance, in:
> |
> | def abc(arg1)
A newbie question.
How can I tell from within a function whether a particular argument is a
sigular type, or a complex type?
For instance, in:
def abc(arg1)
How do I know if arg1 is a single type (like a number), or a list?
In C++, you would do it with function overloading. If arg1 is alw
Try running with the latest version of Python 2.3 instead of 2.4. May be
you would have better luck.
I've found similar stability problems with some of the tools (eventhough
they have 2.4 releases) as well.
I switched back to 2.3 and so far I have no complains.
"StepH" <[EMAIL PROTECTED]> wr
Does this one count?
http://hacks.oreilly.com/pub/h/2630
"Jan Dries" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Michael Hoffman wrote:
> > Gregor Horvath wrote:
> >
> > > Or make any given standard python object accessible from MS Excel in
2
> > > minutes.
> >
> > from win32
"Jan Dries" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Michael Hoffman wrote:
> > Gregor Horvath wrote:
> >
> > > Or make any given standard python object accessible from MS Excel in
2
> > > minutes.
> >
> > from win32com.client import Dispatch
> >
> > xlApp = Dispatch("Excel.
I am trying out PyCrust and at a lost what to do next. With the previous
IDE I tried, the IDE pops up the console and the editor. From the editor, I
can set up breakpoints and debug and so forth. Yes, I can even run the
script.
With PyCrust, the nice looking 3-pane window pops up with lots of t
"Gregor Horvath" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > Absolutely *ugly*!
> >
> > But still, your point is well taken. Thank you for pointing this out.
> >
> > Adam was right:
> >
> >
6, but pythons lists and dictionarys are superior
> to those built in in VB and I think to those in most other languages.
>
> >
> > It's me wrote:
> >
> >
> >>I saw this code from an earlier post:
> >>
> >>lst1 = ["ab", "ac&qu
"Adam DePrince" <[EMAIL PROTECTED]> wrote in message
>
> Don't do it, unless your goal is simply to embarrass and insult
> programmers.
>
I saw this code from an earlier post:
lst1 = ["ab", "ac", "ba", "bb", "bc"]
lst2 = ["ac", "ab", "bd", "cb", "bb"]
dct1 = dict.fromkeys(lst1)
"abisofile" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> hi
>
> I'm new to programming.I've try a little BASIC so I want ask since
> Python is also interpreted lang if it's similar to BASIC.
>
>
>
Is a Ferrari similar to a horse-wagon? Yes, they both have 4 wheels.
:=)
--
It works fine here.
--
It's me
"Chris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm working on a program in PythonWin. The problem I'm running into is
> that after I make a code change, PythonWin doesn't always see it. Has
things is, however, once you structure the package to a form
SWIG would work, it opens up the door to support multiple script languages
(and they have a long list of supported script languages).
If you hand crafted it to run the Python-C API, then you can only use Python
as script.
--
It's m
definitely
would...
--
It's me
"John Machin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Jive wrote:
> "Martin v. Löwis" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > OTOH, people who only have VC6 just need to buy
magical package call SWIG (http://www.swig.org) that
makes writing C wrappers for Python always a child's play. It's incredible!
Where were these guys years ago when I had to pay somebody moocho money to
develop a script language wrapper for my application!!!
--
It's me
"Brad Tille
"It's me" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am playing around with SWING building a Python module using the no
brainer
> example in http://www.swig.org/tutorial.html. With that first example,
>
Oops! Soapy fingers. "SWIG"
r, when I try to access the gloabl variable My_variable by doing:
print example.cvar
I get a blank (rather then a value of 3.0).
Why?
--
It's me
--
http://mail.python.org/mailman/listinfo/python-list
Not to mention that there are packages out there that doesn't work (yet)
with 2.4. Pynum is one such package.
--
It's me
"Larry Bates" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Just because 2.4 arrives doesn't mean that ALL work is stoppe
Yes, if I run the script from the command prompt, it works. I was running
it inside the Python IDE.
Thanks,
--
It's me
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote:
>
>
f time and so I would have to somehow convert a string
to be used as variable. Of course, I can create a dictionary to keep track
of which variable has what name and this method of using exec should be
avoid if at all possible.
I am just trying to understand the language and see what it can do.
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote:
> > Why do I get an "AttributeError: read" message when I do:
> >
> > import sys
> > r=sys.stdi
Yes, Russell, what you suggested works.
I have to chew more on the syntax to see how this is working.
because in the book that I have, it says:
exec code [ in globaldict [, localdict] ]
...
--
It's me
"Russell Blau" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL
ot in).
Some sample code I saw uses this function in the same manner I am and so I
am assuming this is the correct syntax?
Or is this a bug in Python 2.4?
--
It's me
--
http://mail.python.org/mailman/listinfo/python-list
"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi It's me
>
> >
> > a = 3
> > y = "a"
> > print eval(y)
> >
>
> To get 'a' to be 4 here, you would say
>
> a = 4
I am new to the Python language.
How do I do something like this:
I know that
a = 3
y = "a"
print eval(y)
would give me a print out of 3 - but how do I do something to the effect of:
eval(y) = 4# hopefully the value of a gets changed to 4
??
Thanks,
93 matches
Mail list logo