On 12/25/2009 6:50 PM, Mkhanyisi Madlavana wrote:
How do I list all the available variables in python. for example if I say:
a = range(10)
b = 16
c = ""
(some variables)
z = ["this","that","none"]
I then need a command that will list the variables I assigned like:
some_command
a, b, c,
Hi all,
Thanks for your insightful answers, and a merry Christmas + a happy new year!
Btw, somebody on the list mentioned rpy as an alternative way to create spider
charts. I also think that's a better route to take. R is thoroughly tested and
built for the job, and if you ever need more statis
This may also be useful:
>>> a = 1
>>> b = 2
>>> c = 3
>>> locals()
{'a': 1, 'c': 3, 'b': 2, '__builtins__': ,
'__name__': '__main__', '__doc__': None}
>>> locals().keys()
['a', 'c', 'b', '__builtins__', '__name__', '__doc__']
>>>
Cheers!!
Albert-Jan
I'm working my way through Mr Lutz's "Learning Python", and I come to
this snippet (page 271):
while True:
reply = input('Enter text:')
if reply == 'stop': break
print(reply.upper())
which works "as advertised" in an interactive session, but not in a
script. Yes, I tried tossing the
Op 25-12-09 17:49, rick schreef:
I'm working my way through Mr Lutz's "Learning Python", and I come to
this snippet (page 271):
while True:
reply = input('Enter text:')
Try this:
reply = raw_input('Enter text: ')
Cheers,
Timo
if reply == 'stop': break
print(reply.upper
Special offer for coders coding on Christmas day!
I'm looking for the simplest way to decode/encode unicode ordinals (called
'codes' below) to/from utf8. Find this rather tricky, esp because of variable
number of meaningful bits in first octet. Specifically, for encoding, is there
a way to avoi
In writing the following program in creating random numbers and writing
them to the file, I get an type error in writing to file. I have tried
number = random(10,99), number = randint(10.99), and number =
random.random(10,00) and still get various errors of writing to file.
If I were to REM o
Thinking it was a reply to me on Python Tutor,
I translated the following into English for the board.
Ken
� DIAGORN wrote:
Bonjour,
Je suis absente jusqu'au 03/01/10 inclus.
En cas d'urgence Soprane, contacter notre adresse générique
projet.sopr...@teamlog.com.
Joyeuses fêtes de fin d'année.
Thanks! So a file will only take a numeric as a string? Lesson learned.
Again, thanks.
Ken
Amit Sethi wrote:
It is as the Error says a type error , the function takes a string and
u are passing an int
if you put
file.write(str(number)) you will not get error ..
__
Ken G. insightbb.com> writes:
> [...]
> Do I need to convert a numeric random number to a string number?
> [...]
Yes, as long as you open the file as "w" you need to use "repr()" [repr(int)].
If you want to save the integer, you need to open a file as "wb", write binary.
Check your documentation
On 12/25/09 15:00, Ken G. wrote:
In writing the following program in creating random numbers and writing
them to the file, I get an type error in writing to file. I have tried
number = random(10,99), number = randint(10.99), and number =
random.random(10,00) and still get various errors of writin
"rick" wrote
while True:
reply = input('Enter text:')
if reply == 'stop': break
print(reply.upper())
which works "as advertised" in an interactive session, but not in a
script. Yes, I tried tossing the script to both versions of
interpreter, it doesn't work with either 2.6 or 3.1.
"Ken G." wrote
the program run fine. Do I need to convert a numeric random number to a
string number?
You need to convert your data to a string if you use a text file,
which is the default. If you open the file with 'wb' you can write
any kind of data to it, but you will have to decode it w
Hi all,
I'm having a design issue that's really bothering me. The code I'm writing
is fairly large by now, but I've written what I think is a decent example
that illustrates my problem.
My app launches threads that each consume messages from a queue, send them
to a processor object, and then the
The docs say
"write( str) - Write a string to the file."
Only a string. Regardless of mode. Mode mostly affects interpretation of
line ends.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change s
On Fri, Dec 25, 2009 at 9:03 PM, Brian Jones wrote:
> Hi all,
> I'm having a design issue that's really bothering me. The code I'm writing
> is fairly large by now, but I've written what I think is a decent example
> that illustrates my problem.
> My app launches threads that each consume messages
On Sat, 2009-12-26 at 03:03 +0100, tutor-requ...@python.org wrote:
> > which works "as advertised" in an interactive session, but not in a
> > script. Yes, I tried tossing the script to both versions of
> > interpreter, it doesn't work with either 2.6 or 3.1.
>
> Somehow you are picking up an ol
17 matches
Mail list logo