oesn't_ call the
__init__ method of any superclasses. There are several good reasons
for this --- it doesn't know what parameters you want to pass to the
superclass __init__ methods, or when you want to call them. So, it is
up to you to make that call.
You can do that like this:
class sub(
w')
pickle.dump(world,f)
f.close()
This is all you need, because 'world' contains all the information
about your world. Then, when you load the data back, you will need to
figure out some way of building your 'rooms' data structure from
'world'.
Does thi
5 of them, and 3
bits left over. But there's an easier way to do that calculation ---
the modulo operator:
>>> len(b) % 4
3
That's how many extra bits we have, so we can subtract that from n to
get the number of '0's we need to pad with.
Does that help?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
'30' will create a new (local) variable x and give it the value '30'.
x.append('20') will call the .append() method on x. Calling this
method has the side effect of changing the list x points to.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
e of good python implementations around that
you could google for..
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
n existing int.
Also, if you're playing with stuff at that level, you might find the
struct module helpful.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
IP address, name, IP name)? Also, could you tell me how to find it on a computer? Since I'll be testing the instant messenger on the three computers in my house, I just need to know how to find the information on the computer I'd currently be on (not from any remote location). Thanks! :
27;re almost there...
>>> a = ['apple', 'is', 'a', 'good', 'fruit']
>>> ' '.join(a)
'apple is a good fruit'
>>> '...'.join(a)
'apple...is...a...good...fruit'
>>> '\n'.join(a)
'apple\nis\na\ngood\nfruit'
>>> print '\n'.join(a)
apple
is
a
good
fruit
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
/FAQ page which deals with printing text files or
is there simple code which prints a text file?
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
;, 'The system cannot find the file
specified
.')
I have played about with it and saved it in various places but I can't get
it to work. Any suggestions? Do I need to import other modules? Do I need
to use Pythonwin?
Thanks,
John.
-Original Message-
From: [EMAIL PROT
Hi
I am trying to execute some MySQL commands using
some python scripts
I want to do a mysqldump of my database john to
a file backup.date.sql
the normal command to take a dump is
mysqldump john> backup.sql
I tried python , by importing
import
"+target_dir+"/table.bak.sql")
>
> dont forget the p in front of your password !
>
> hope this helps
>
>
Hi it helped me a lot ,
I did my script like this for backing my zabbix
database
import os, time
# difine the target directory
target_dir = '/ho
Hi
I am trying out learning python , using the book
Python Programming for the absolute beginner by
Michael Dawson
I get
File "page114.py", line 12
inventory = ("Sword","Armor","Shield","Healing
Potion")
^
SyntaxError: invalid syntax
when I run the program
--- Brian van den Broek <[EMAIL PROTECTED]> wrote:
> Hi John,
>
> sometimes the syntax error indicator isn't quite
> pointing to the
> problem. In your case, the place it points was where
> Python worked out
> there was a problem, but the difficulty with yo
Hi All
I am trying to write a program in which I enter
the no of students and then for the students I enter
the marks and later on Display the marks
The script which I wrote is given below , when I run
the program I get error
TypeError: object doesn't support item assignment ,
my aim in
ile
will print to the printer.
The code that I am using is below:
import win32api
filename = "testprint.txt"
fileobj=open (filename, "w")
fileobj.write ("This is a test")
fileobj.close()
win32api.ShellExecute (
0,
"p
more , I am adding the
program which I had done
Thanks to the list , I am getting more
encouragement here ,it is fun over here
Thanks
Joseph John
***
# This program
Hi
I am trying to write a program in which it ask for
entries for the list , But if I press Enter it should
exit the while loop without giving errors ,I have
problem in making it work , right now if I press enter
to exit , the program terminates showing error
I am added my script wh
nter/scripts/python/pyindex.mspx
useful to you?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
api.GetVolumeInformation('D:/')
>>> '%X' % cdi[1]
'49BC31DB'
So, on my system (ActivePython 2.4, WinXPpro) there is no need for magic.
I've got Mark Hammond's pywin32 book, but it doesn't talk about
win32api.GetVolumeInformation().
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi All
I was able to exit the while loop , using sys
module
also I was able to find the maximum no of marks
entered , I am adding my code , for comments and
suggestions
Thanks for the support
Joseph John
o I have to
do something different on the windows 98SE machine? Any help would be
greatly appreciated.
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
[resending 'cause I forgot to address to tutor..]
On 05/01/06, John Corry <[EMAIL PROTECTED]> wrote:
> This code works on windows XP + Windows 2000. However it does not work on
> windows 98SE. I have tried this code on 3 seperate machines with windows
> 98SE. They all c
Notepad opens and prints the text file.
Regards,
John.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of John Fouhy
Sent: 04 January 2006 21:54
To: Tutor
Subject: Re: [Tutor] Further help needed!
[resending 'cause I forgot to address to tutor..]
On
h it is that it reads integers as
strings, but I haven't looked at the latest version so this may be
fixed, and if you're just writing out to CSV file that won't matter
anyway.
[be aware, though, that any dates in the spreadsheet will turn into integers]
--
John.
_
.selection_set(0) will select the first item (just
make sure the listbox isn't empty).
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
dule are deprecated in favour of calling methods on
strings themeslves.
So, instead of saying:
> new_file_string = string.replace(file_string, ' ', '_SPACE_')
You would say:
new_file_string = file_string.replace(' ', '_SPACE_')
HTH!
--
John.
quot;This is a test")
fileobj.close()
win32api.ShellExecute (
0,
"print",
filename,
None,
".",
0
)
The code above gives me the error: (31, 'ShellExecute', 'A device attached
to the system is not functioning.') However
for win xp + win
2k.
Onto my next problem.
My text file is printing out in portrait. Is there any instruction that I
can use so that notepad prints it in landscape?
Thanks,
John.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Terry Carroll
Sent: 07 January
Hi All
I am trying to find out the duplicates in a list
, as for beginning I wanted to compare the adjacent
elements in list , for this purpose I wrote a script
for checking the adjacent elements in a list, if same
, it prints the result that , the adjacent numbers are
same , it not it wi
or loop for this message
to go
my for loop is as
for j in range(length) :
if seats[j] <> seats[j+1]:
print " The Seat", j , "And the seat",
j+1 , "value, which are", seats[j]," and", seats[j+1],
"are not
Hi,
My text file is printing out in portrait. Is there any instruction that I
can use so that notepad prints it in landscape?
Thanks,
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
d Hat 3.4.2-6.fc3)] on linux2
THANKS
Joseph John
--- Brian van den Broek <[EMAIL PROTECTED]> wrote:
> John Joseph said unto the world upon 08/01/06 06:36
We no longer need the continue clause, as converting
to set ensures we
won't ev
because steps is not an integer
Sounds like you want string substitutions.. You can read about them
here: http://python.org/doc/2.4.2/lib/typesseq-strings.html
For instance:
>>> steps = 6
>>> ">%s" % steps
'>6'
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
'xfooybarz'
So, in your case, try something like '>%s+f'.
> also this still requires me to reassign 6 to steps
>
> isnt this already done here ?
>
> >>> s = L[:4]
> >>> s
> ('\x00', '\x00', '\x00', '\x
#x27;win32'
[actually, it does a bit more than just that; read the docs]
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ss MyClass(object):
... def __init__(self):
... print 'Initialising MyClass instance now...'
... self.x = 3
...
>>> m = MyClass()
Initialising MyClass instance now...
>>> m.x
3
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--- Chris Andrew <[EMAIL PROTECTED]> wrote:
> Hi, all.
>
> I wonder whether you can help. I've just subscribed
> to the list, so look
> forward to participating. I have been using GNU/
> Linux since about 1999,
> but am a complete newbie when it comes to
> programming.
>
> I bought the O'Rei
--- Danny Yoo <[EMAIL PROTECTED]> wrote:
> >I get the error for set
> > >>> set((1,1,1,2,2,2,2,2,3,4,4,5))
> > Traceback (most recent call last):
> > File "", line 1, in ?
> > NameError: name 'set' is not defined
ed in this way
while (condition no 1) & (condition no2):
print Results
I request guidance
Thanks
Joseph John
___
NEW Yahoo! Ca
or GET. So, even if you are using POST, clever kids could, I
think, construct a GET url to do the same thing.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Anyone know anything about the 'copyright' statement? help(copyright)
is not ultra helpful, and I can't see anything in the docs (eg,
http://python.org/doc/2.4.2/ref/simple.html doesn't list it). Is it
ever intended to be used in n
7; and 'None' as well :-/ )
Open mouth, insert foot, echo internationally...
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
2
'usqom'
And if you omit the start or stop parameters, and step is negative,
then start defaults to the end of the list and stop to the beginning.
So string.lowercase[::-1] will step backwards, starting at the end and
finishing at the start.
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi
I wanted to try out python with MySQL databases
, I would like to get info about the link to sites ,
which gives you examples on how to do python
programming by using MySQL database
Please guide
Thanks
Joseph John
Please guide me , why I am not
getting any results displayed
Thanks
Joseph John
***8
""" For learning for
To connec
for the reason
for this behavior
I had added my script in this mail
Thanks
Joseph John
*
""" This program is for to learn
how to enter data to MySQL using python
thon , how to call the pattern matching inside
mysql query
I had added my code
Thanks
Joseph John
***
import MySQLdb
s_email= raw_input("Enter the some part of the Email
to be
On 26/01/06, Jon Moore <[EMAIL PROTECTED]> wrote:
> Hi
>
> Is there anyway to print informtation from dictionaries better than this?:
Well, you can print the value too if you want :-)
eg:
>>> pairs = {"Jon Moore": "Tony Moore",
...
init__ method. So I guess this is just a
typo --- if you change "self.decriptors" to "self.descriptors", you
might have more luck :-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi
I am sending the code of the function
"searchbyemail" and the output of the program when I
run
I am trying to search and display the results , even
if we give a part of the email_id
thanks
Joseph John
SEARCH by
--- Danny Yoo <[EMAIL PROTECTED]> wrote:
>
> Hi John,
>
> Ok; because the question you're asking looks a
> little homework-y, we have
> to be a little bit more cautious in our answers.
> What part are you
> getting stuck on?
>
>
> Do you understa
--- Danny Yoo <[EMAIL PROTECTED]> wrote:
> > the email id which starts with j is
> > select * from contact where email_id like 'j%';
>
> Hi John,
>
> Ok, looks good so far. So in a Python progr
raceback (most recent call last):
File "", line 1, in ?
NameError: name 'x' is not defined
which might give you a better clue as to where the problem is.
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
happy about whitespace either side of the '.'
operator.. Some of the wxPython guys like their whitespace, eg:
http://wiki.wxpython.org/index.cgi/DataAwareControlsMixin#head-d1249e34e446972c34012a866f67bc184db7bc52
:-)
--
John.
___
T
reshtml = '''Content-Type: text/html\n
Friends CGI Demo (dynamic screen)
Friends list for: Joseph
Your name is: John
You have 20 friends.
'''
When I access this script from the url
http://192.168.20.99/~john/ sample-test.py
in the browser I see the contents of
#x27;wraplength']
So, these are the possible things you can configure with a Tkinter.Button.
Also, the online documentation at python.org is very good. I
recommend going to http://www.python.org/doc/ and downloading the
current documentati
> self.setstatus).grid(row=6,column=0,sticky=W)
Why are you assigning these to self.test?
(in particular, you realise that the results of these grid() calls
will be None?)
> if (self.costlistradial.get()):
> self.e_list['state'] = 'di
ry', finishing the string
there.
A triple-quoted string should work for you because lone single or
double quotes in a triple-quoted string are passed literally.
Otherwise, you need to escape them --- ie: 'insert on table
\"category\" ...'.
HTH!
--
John.
_
song ranked 50 will be fifty times more
likely to be chosen than a song ranked 1, while a song ranked 80 will
be only 1.6 times more likely to be chosen than a song ranked 50.
Maybe some kind of logarithmic transform might smooth things out a
bit..?
--
John.
__
, for instance:
>>> n = 'xb1jyzqnd1eenkokqnhep6vp692qi9tmag3owzqw0sdq3zjf'
>>> n[0:3], n[3:6]
('xb1', 'jyz')
Can you see how to generate the slice boundaries for the length you need?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
programming with a GUI, one good way
is to use .after_idle.
ie, instead of myturns.insert(str(i)), do
top.after_idle(myturns.insert, str(i)) (I think this is the right
syntax). This will cause the mainloop thread to run the code instead.
HTH!
--
John.
_
database files. I can see the database files in the
dist folder.
Are there other files which I have to manually copy into the dist folder
such as the sql_mar.py?
Any help or pointers would be greatly appreciated. I know that this is a
py2exe specific question but I have
G'day, I'm new to Python and new to the list and just thought I'd say a quick hello before asking my 1st dumb question. My name is John and I live in Australia, I've been using computers since about 1983. I haven't done any programming since the commodore 64 basic days
On 16/02/06, John Connors <[EMAIL PROTECTED]> wrote:
> My 1st dumb question: I have a copy of Teach Yourself Python in 24 Hours,
> printed in 2000 so I guess it's virtually usless but i was hoping to learn
> some of the basics from it. There is a small bit of code near the
&
round to printing it out sooner or latter (when the Mrs isn't here so
she won't complain about me wasting ink and paper).
John
_
realestate.com.au: the biggest address in property
http://ninemsn.realestate.com.au
random numbers
between 1 and 44 inclusive
print games, lotto
print
else:
print
print "Hope you win!"
I know this is a very simple program but... could I have done this a better
way?
John
_
Search for loca
d a
function definition with an extra carriage return.
(at least, that's the way it works in the console version)
eg:
>>> def foo():
... pass
... def bar():
File "", line 3
def bar():
^
SyntaxError: invalid syntax
hing short of closing the shell and re-opening it that I can do
> to fix this?
Have you tried restarting IDLE? The first thing to do would be to
verify that the problem is what you think it is (as opposed to a bug
in your code, for example).
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
hat randint is in the random module.
ie, instead of calling randint(), call random.randint().
Have you been through the tutorial on python.org? It is quite helpful.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 20/02/06, Kermit Rose <[EMAIL PROTECTED]> wrote:
> >>> import factor30.py
>
> Traceback (most recent call last):
> File "", line 1, in -toplevel-
> import factor30.py
> ImportError: No module named factor30.py
Because the module is named
>>> def p():
... print 'foo'
... print 'bar'
... print 'baz'
...
>>> def q():
... print 'foo',
... print 'bar',
... print 'baz'
...
>>> p()
foo
bar
baz
>>> q()
foo bar baz
As to formatting your list
a minimal
roguelike, intended to show how to get started. Written by Thomas
Biskup (of ADOM fame). It might give you an idea of the kind of data
structures you might be able to use to represent the map.
--
John.
___
Tutor maillist - Tutor@python.org
ht
On 21/02/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> Have you looked at QHack?
Oops, I forgot the link: http://adom.de/misc/qhack.php3
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
le('/home/mutt/lotto.txt','a').write('')
file('/home/mutt/lotto.txt','a').write(str(lotto_numbers))
file('/home/mutt/lotto.txt','a').write('\n')
print '\nHope you win!'
file('/home/mutt/lotto.tx
#x27;a').write('Game: ')
file('/home/mutt/lotto.txt','a').write(str(game))
file('/home/mutt/lotto.txt','a').write('')
file('/home/mutt/lotto.txt','a').write(str(lotto_numbers))
file('/home/mutt/lo
se
(appropriately enough) a dictionary. You can read about dictionaries
in the tutorial here:
http://docs.python.org/tut/node7.html#SECTION00750
If you want to do genuine translation, like English to French or
something, then, well, ask someone who works at Go
number_of_balls +1), 1)
print '%3s\t%s \tPower Ball: %s\n' % (game, lotto_numbers,
pwrball)
save_numbers = 'Game: %3s\t%s \tPower Ball: %s\n' % (game,
lotto_numbers, pwrball)
f.write(save_numbers)
print '\nHope you win!'
f.write('\nH
, bad habits but I'm starting to miss them.
John
_
New year, new job there's more than 100,00 jobs at SEEK
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t
better at reading the code.
Very good point. I have to go away for 3 weeks in a couple of days and I was
trying to leave helpful hints to myself in the code so I won't forget what I
have learnt. But you are right, I got carried away and most were just
G'day,
I think my peanut sized brain is starting to understand how to do this. I
tried with a simple dice game where 4 dice are rolled, if the total of the
last 2 dice rolled is 6 you win. It's kinda pointless using 4 dice rolls
when only 2 are needed but I wanted to prove to myself I could cal
who assist in here.
Sorry if I've done the wrong thing.
John
_
Search for local singles online @ Lavalife - Click here
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthr
Hello,
I'm writing a system admin script in python that checks recently
accessed files for keywords like "failed, denied, error,..." etc. I'm
using popen to call grep -F but it's VERY slow. Can
anyone suggest a faster method to do this?
Thanks,
John Purse
On Fri, 24 Feb 2006 12:23:22 -0800 (PST)
Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Fri, 24 Feb 2006, John Purser wrote:
>
> > I'm writing a system admin script in python that checks recently
> > accessed files for keywords like "failed, denied, err
/snd/') if f.endswith('.aif')]
Or, slightly more robustly (?),
snd = [os.path.join('/Users/kevin/snd', f) for f in
os.listdir('/Users/kevin/snd/') if f.endswith('.aif')]
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
mpleHTTPServer, again both in
the standard library. I've never used them, but it seems like they
will drastically simplify the task of making a web server.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
including Perl, Python, (ba)sh,
and SQL, so the syntax sometimes seems to fight itself. But, overall,
I'm very impressed. It looks a lot like the python interpreter,
except customised to focus on file manipulation and process management
(since that's what s
Sorry guys, total brain fart there :-)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
didas handball shoes. Expect to pay $200 or more, though.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
if the mouse is
within the button, and then activate your callback.
Something else you could try (which I haven't tested) --- instead of
box.cancel.bind, do box.cancel.config(command= ...).
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
playback engine!
Pamie allows you to automate I.E. by manipulating I.E.'s Document
Object Model via COM. This Free tool is for use by Quality Assurance
Engineers and Developers.
"""
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
I have a file that is a long list of records (roughly) in the format
[EMAIL PROTECTED]
So, for example:
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
What I would like to do is run a regular expression against this and
wind up with:
[EMAIL
use a generator expression
(requires Python 2.4):
>>> sum(x for y in foo for x in y)
45
This will be slightly faster, depending on how big your list is.
But really, there are times when clarity and efficiency both come
together and say "Write explicit for loops" :-)
--
John.
___
y of sample python scripts for automating WIndows:
http://www.microsoft.com/technet/scriptcenter/scripts/python/default.mspx
There may be something helpful there..
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 24/03/06, Naomi Guyer <[EMAIL PROTECTED]> wrote:
> Till just before 1pm would be good. That way I can make the practice at
> Martin Luckie at 1pm.
As a lifetime member of the Vic flying disc club, I can write you a
note excusing you from being late if you like
the flies needed to make it go. It
still means you can run your programs on Windows systems without
python installed, though.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
return self.keys
def setDefault(self, key):
self.default = key
HTH!
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
This actually sounds like very good idea. I have not heard of it before, but I think it would be a very good way to learn. Let me know if you find anything.JohnOn 3/28/06,
Noufal Ibrahim <[EMAIL PROTECTED]> wrote:
Greetings all, Are there any programs for python that offer an "interactive" tutor
e exactly three letters long. Can you see how to write a loop
to produe this output?
Hint: the len() function will tell you how long a string is.
eg: if vehicle == 'car' then len(vehicle) == 3.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
}
>>> D['d'] = {'a':7, 'b':0}
>>> D['d']['c'] = 1
>>> D
{'d': {'a': 7, 'c': 1, 'b': 0}}
Are you sure you haven't mistakenly assigned something other than a
dict to D or D['d'] ?
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
501 - 600 of 1089 matches
Mail list logo