e:
# do different stuff
Also, I hear that optparse is much better than getopt.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge
a perfect
uld you make this work?
>
You may want to have a look at the string ljust() and rjust()
methods.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you c
On May 15, 2005, at 06:54, Terry Carroll wrote:
> if (a == b &
> a == c &
> a == d &
> a == e &
> a == f &
> a == g):
> do stuff
>
Well, you can already try this:
if a == b == c == d == e == f == g:
do stuff
-- Max
>>> import os
>>> os.listdir("Prog")
['.DS_Store', 'archive', 'C-Cpp', 'docs', 'eclipse', 'gi21',
'Haskell', 'Java', 'matt', 'ObjC', 'Python']
-- Max
o this. So, any
> comments are really appreciated.
Looks like a job for a list comprehension:
fileNames = [element for element in fileNames if not element.endswith
("_thumb.jpg")]
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature
ained
with the shortcut var[-1].
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge
a perfect, immortal machine?"
___
nd they also have the has_key() method, which can be used to
test for the presence of a key in a dict:
>>> a.has_key('foo')
True
>>> a.has_key('baz')
False
What you are looking for can be achieved like this:
>>> dol = {'key1':['li1&
scores. The line should be changed to:
if __name__ == "__main__":
Hope that helps,
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through
e source of the error.
Lacking that, could you send us the exact error message, please?
Just copy/paste whatever the interpreter throws at you; error
messages are very useful to us.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of me
Also, note that this code will likely cause the program to crash
on any system that isn't Linux. On my box (OS X 10.4.1), for example,
sys.platform returns 'darwin'.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone
rust me, the time you take to write them is by far lower
than the time they save you tracking and correcting bugs if you don't.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my co
string and not a
regex pattern, you don't have to use regular expressions:
if "locale for" in line:
print line
Works just as well, and is faster.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, pant
ery
> working, you could
> automate it using VBA or Python.
>
> Mike
If you want to do it in Python, the easiest way is to export the
spreadsheet as CSV in Excel, then use the csv module to do your
processing. If needed, convert back to XLS afterward.
-- Max
maxnoel_fr
filter, whatever) WAV files, not to play them.
Playing a sound is a highly OS-specific function; PyGame is a
cross-platform library that enables this, among other things.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, pa
(meh, forgot to click "reply-all" again)
Begin forwarded message:
> From: Max Noel <[EMAIL PROTECTED]>
> Date: May 24, 2005 23:01:39 BDT
> To: "D. Hartley" <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] xml
>
>
>
> On May 24, 2005, at 22
16.7 million.
This is where the palette comes into play. Each 256-color image
has a palette, which is basically an array of length 256, where each
element is a (24-bit RGB) color. The color data for each pixel in the
image is actually an index in this array.
Makes sense?
-- Max
. The (more-or-less)
equivalent command is ipconfig, except that it has no generic names
for network interfaces. What that means, is that instead of eth0 (or
en0, or whatever), it uses the full name of your NIC -- which
effectively means that the output differs from one machine to
another. G
ment calls the
function, then assigns to s the representation of the function's
return value. A function that doesn't have a return statement returns
None, and repr(None) == 'None'. Which is what you get.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at y
it, all members of
the list seem to be modified as well -- but they're actually one
single object that's present 10 times in the list.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
ple:
#!/usr/bin/env python
import time, sys
for i in xrange(20):
sys.stdout.write(".")
sys.stdout.flush()
time.sleep(0.2)
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run
me... How do you run it? Do you use a separate
terminal window, or do you use some kind of "run with Python" command
in emacs? (not sure how it's done, I'm a vim user myself)
Did you make sure you import time before that code is run?
-- Max
maxnoel_fr at yahoo d
On Jun 14, 2005, at 23:17, Pujo Aji wrote:
> I just use Ctrl+C Ctrl+C to run the code.
> The code wait for 3 second and show all i all together.
>
> I can't feel every second pass.
>
> pujo
Try running your script from a terminal (outside of emacs, that
is).
--
On Jun 17, 2005, at 11:58, János Juhász wrote:
>
> Dear Guys,
>
> I have a 2D array:
>
>>>> [['1', '2 ', '3'], ['longer ', 'longer', 'sort']]
>>>>
>
>
> How can I get what is
ution does not include the curses module (you
have to use msvcrt[?] instead). I wonder why, because I'm pretty sure
I saw (C) curses-based applications running on Windows (NetHack is
one, AFAIK).
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic c
.
The whole process is called "bootstrappping" (from the
Adventures of Baron Munchausen, as you mentioned), and exists for all
compiled languages (including assembly). In fact, every language
except microcode was at some point either bootstrapped or cross-
compiled.
-- Ma
starts with values of 0. But how can I neatly say,
start with a random value from (for example) 1 - 5?
thanks
Max
___
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http
' printed out, since it is
the result of the function. How can I correct this?
You have to call the function:
get_Name(prt_Name())
prt_Name is the function itself. prt_Name() (note the parens)
calls (executes) the function and allows you to use its return value.
-- Max
maxnoel_
store full, etc. ).
Any recommendations on a way to do this? i.e. what modules what
methods?
For all your XML processing needs, you need ElementTree (http://
effbot.org/).
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and
rt sys
>>> sys.is_computer_on_fire()
True
In any cas, you should try to avoid using file.read without a
size parameter. If you're processing text files, reading them one
line at a time would be a good start (for line in open
('filename.txt'): is an instance of Best Thin
do to read a list into a listbox.
Should I preformat the list I read from to be one
entry per line?
I don't know if I want to pickle my data as i need to
be able to delete defunct list entries from my little
GUI application.
thanks
Max
__
o be used with lists in addition to dictionaries.
While we're on that topic, is there a particular reason why
'in', in a dict context, searches the keys instead of doing the
logical thing and searching the values?
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Loo
ok after reading a few tutorials i think i know enough to write my
program
here it is
not commented yet though sorry:
import curses
from time import sleep
scr=vurses.initscr()
population=0
seconds=0
try:
scr.nodelay(1)
scr.leaveok(0)
max_y, max_x = scr.getmaxyx()
hello all sorry to bother I'm working on my first curses program ive
been wanting to learn curses for a while now and now that a have a
lop top with fedora core running in run level 3 ware im trying to
program all the tools i'll use but curses will be my only gui ALAN
has been helping me wi
im writing a quick quote reader that spits out a random quote from a
show but cant get it to pick randomly
i tried
a=randrange(820)+1
text.readline(a)
and i would prefer not having to bring evryline into the program then
picking like
for line in text.readlines():
lines.append(text)
.
hello all sorry to bother I'm working on my first curses program ive
been wanting to learn curses for a while now and now that a have a
lop top with fedora core running in run level 3 ware im trying to
program all the tools i'll use but curses will be my only gui ALAN
has been helping me wi
has anyone ever written a web browser with python and Tkinter? if so
is there any documentation on it? if not does anyone know if their
which tutorials i should read if i wanted to write one for my apple?
i don't know vary much Tkinter so i was going to start there
then i thought i would be us
hello im checking if a number is in all 5 of the other lists and when
i use the and command it seems to just be checking if it's in a least
one of the others, here is the program it's choppy i needed it for a
quick calculation so it's not pretty but it's not long:
n2=2
n3=3
n4=4
n5=5
n6=6
n
if a+1 in l7:
print a+1
On Aug 24, 2007, at 1:25 AM, Alan Gauld wrote:
>
> "max baseman" <[EMAIL PROTECTED]> wrote
>> im checking if a number is in all 5 of the other lists and when
>> i use the and command it seems to just be checking if it's in a
>>
quick question how would i clear a text document?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
t
4,2,1,4,2,1...
now im looking for a a number with a very high amount of numbers
till you get to 1 so every time it's finds a new one i would like it
to write that to a file and clear the last entry,
On Aug 29, 2007, at 5:45 PM, Alan Gauld wrote:
>
> "max baseman" <
cool thank you :)
On Aug 29, 2007, at 11:02 PM, Luke Paireepinart wrote:
> max baseman wrote:
>> right it's for a quick math "game" the rules are simple you start
>> with any number to get the next number you, a. if it's odd
>> multiply by 3 th
Johnson wrote:
> max baseman wrote:
>> right it's for a quick math "game" the rules are simple you start
>> with any number to get the next number you, a. if it's odd
>> multiply by 3 than add 1 or b. if it's even divide by two, the
>>
hello just a quick check in, it's about the same program i was asking
about before ive let it sit for a few days now and i reached a number
to high to convert to a decimal by adding 0.0
here's the program:
count=1
numstart=268549802
number=0
high=0
a=0
while 1==1:
numstart=numstart+1
h
>
> if number%2 == 0:
>number = number/2
>
> Why do you need to convert it to a float?
>
> Off topic:
> Is this a PE problem? I remember doing the same thing.
>
> max baseman wrote:
>> hello just a quick check in, it's about the same program i was
>
r=(number-1)/3.0
... count=count+1
... print number
On Sep 4, 2007, at 3:00 AM, Alan Gauld wrote:
> Max,
>
>> just wondering if theirs a way to check if a larger number is even
>> or
>> odd
>
> I notice this is homework so I won't give a direct answe
hello all this is a homework in math i dont need to program it but i
would like to :) so like any other time pleas dont just give a
answer tutorials or a explanation. i dont like to use script
something i dont understand :)
thanks
basically the problem is to find a bunch of ways to put 1,
hello all this is a homework in math i dont need to program it but i
would like to :) so like any other time pleas dont just give a
answer tutorials or a explanation. i dont like to use script
something i dont understand :)
thanks
basically the problem is to find a bunch of ways to put 1,
problem was listed in a chapter entitled
> "Cruel and Unusual"!
>
> -Sam
> ____
> - Original Message
> From: max baseman <[EMAIL PROTECTED]>
> To: tutor@python.org
> Sent: Monday, September 10, 2007 6:28:23 PM
> Sub
wow this is a bit over my range of knowledge im impressed :) ill be
happy to look at it but i think i will see if i can end up writing
my own :) worse case ill do it by hand will not take long hmm wow
thanks :)
On Sep 10, 2007, at 8:47 PM, John Fouhy wrote:
###
import operator
bino
sentences run together and
> difficult to read. :-) Honestly, I just gave up after the first two
> lines.
>
> max baseman wrote:
>> haha :) yeah it's the new imp stuff i like parts of the idea but
>> other parts i really dislike basically it TRIES to make math
&
hello just a quickie today :)
how is python with patters or finding a rule for something ie: in out
tables
for example how hard would it be to write a program that take's a
input of a in out table and finds the rule
ex:
in out
10 23
5 13
1
hello im working on my first simple gui using Tkinter
i've got two questions, 1st how would you go about creating a hidden
text file that trys on a apple and if that does not work tries to do
it on a windows computer?
the program I'm making is a vary simple text editor for one file all
it ne
27;ve ever read i really like and that was the first place i
checked but in the GUI section the text entry bit is for a single
line of text
On Oct 3, 2007, at 3:58 PM, Alan Gauld wrote:
>
> "max baseman" <[EMAIL PROTECTED]> wrote
>
>> i've got two qu
hello all, im sorry but i might be asking a lot of Tkinter questions
for a bit.
im still working on my first GUI, it is very simple all i want it to
do is open a text file, write to it, than save it. so far i have a
GUI with the ability to right text (nothing amazing), but i don't
know how
hello all, i have been rolling the idea of writing a simple script to
play the classic card game war. i thought it would be good for me
because their is no skill in the game. while thinking of how to write
it i got stuck on one bit, how do i make it so that their is one of
each card and i c
hey i just have a small question, doesn't have much to do with
programing but it has to do with python.
anyways Im running a apple computer version 10.4 and have been
keeping my scripts in the user folder i was wondering where and how i
can change the files that python looks in when looking
Hi:
I've been working on this for ages and am having real
problems with getting the wiring for a selected game
to launch when I click OK.
I haven't added my error handling yet.
Can anyone help?
I've tried using spawn, system etc etc to no avail.
#Mame Launcher
#GUI launcher for MAME games
#F
I was using 2.3 but upgraded to 2.4 last night because
I had read about the subprocess module (then Danny
also brought tat to my attention.)
The wierd spacing is just Yahoo, sorry!
I'm probably going to try the same project in WX and
then QT, just to get a flavour.
thanks
Max
--- Alan G &l
the CMD prompt
like it is trying it and not waiting or getting some
kind of return.
I'm really not sure where I'm going wrong at all! I'll
try re-writing using sub-process as I've upped my
Python to 2.4.
--- Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Fri, 9
selection)
raw_input()
mame reports files missing, but I can launch the game
manually- I suspect that this is some sort of error
that occurs normally but is bypassed on launch and
that my one-shot attempt to launch the thing cannot
handle. I think I need to have a wee look at
subprocess!
ta
.append(diff) print changes break Now, I have a lot of print statements in there for debugging purposes, but I don't understand why when I run it, and it parses through my input directory and comparison directory it returns this
Nonecomp
give good
examples of this?
thanks
Max
RussellSenior
Test Engineer
BarcoBonnington
Bond, 2 Anderson Place, Edinburgh EH6 5NP, UKTel + 44 (0) 131 472 5731 Fax +
44 (0) 131 472 4799www.barco.com[EMAIL PROTECTED]Unless
indicated otherwise, the information contained in this message is
formsFile() global
typeCategories typeCategories =
self.GetTypesFile()
The method above is
within Directory and updates the two lists with the values I need. (The methods
called within GetCategories do the returning of the lists.)
I think I've got a
grasp on what was going wr
I know this is totally off-the-wall, but what am I doing wrong here? I am
using Python 2.5, and I am just learning...please be kind!
>>> aList = [2,3]
>>> bList = [5,7,9]
>>> aList.append(bList)
>>> print aList
[2, 3, [5, 7, 9]]
>>> print aList [1] [2]
Traceback (most recent call last):
File
as a fun little project i scripted a powerball program. it seems to
have a bug in it that i cant find.
from random import randrange
wins=0
win=[]
count =0
while count !=5:
number=randrange(55)+1
win.append(number)
count=count+1
powerball=randrange(42)+1
count=0
win.sort()
while coun
hello and thank you everyone for your help.
I apologize for my ignorance when it came to knowledge of what the
powerball is it is not as wide spread as i had thought it was
the powerball is a form of lottery their are 5 numbers between 1 and
55, and then their is the powerball between 1 and
On Jan 10, 2011, at 7:58 AM, arun kumar wrote:
> how to know that we
> should import something. How do we know that certain classes are in
> particular module?
You know to import a module if you need part of that module. Perhaps you need a
class or function defined in the module.
There are seve
TER to quit)",
state = raw_input("> ")
if not state: break
city_found = cities['_find'](cities, state)
print city_found
My question is - how do I rewrite this using an alternate module given
find is deprecated? Grateful for all suggestions or pointers. For
ref
n the code, the error I got was:
max:python max$ python ex40.py
State? (ENTER to quit) > CA
Traceback (most recent call last):
File "ex40.py", line 22, in
city_found = cities['_find'](cities, state)
File "ex40.py", line 8, in find_city
return th
I've been doing some research into C++, and I've noticed the for loops. Is
there a way to use the C++ version of the loops instead of the Python one?
For example, I believe that the Python syntax would be:
for a=1, a < 11, a += 1:
print(a)
print("Loop ended.")
if the 'for' keyword did it's f
Thanks!
On Wed, Oct 12, 2011 at 8:56 PM, bob gailer wrote:
> On 10/12/2011 8:41 PM, Max S. wrote:
>
>> I've been doing some research into C++, and I've noticed the for loops.
>> Is there a way to use the C++ version of the loops instead of the Python
>> one
I have seen classes created with 'class Class_Name:' and 'class
Class_Name(object):'. I'm using the latter, just in case it has some sort
of method that could be useful that I don't know about, but *are *there any
methods in the 'object' class? And if so, what are they?
__
On Sun, Oct 16, 2011 at 3:44 PM, wrote:
> Send Tutor mailing list submissions to
>tutor@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>t
Heh, yeah. It's usually a bad idea to do stuff like that (I know a guy
(Windows) who deleted his OS of his system).
On Nov 1, 2011, at 7:40 PM, Joel Montes de Oca wrote:
> I just discovered that it is a bad idea to complete uninstall Python 2.7 on
> Ubuntu 11.10. If you do, expect a lot of thi
Is it possible to create a variable with a string held by another variable
in Python? For example,
>>> var_name = input("Variable name: ")
(input: 'var')
>>> var_name = 4
>>> print(var)
(output: 4)
(Yeah, I know that if this gets typed into Python, it won't work. It just
pseudocode.)
I'm on a
Thanks Steven.
On Nov 4, 2011, at 6:45 PM, Steven D'Aprano wrote:
> Max S. wrote:
>> Is it possible to create a variable with a string held by another variable
>> in Python? For example,
>
> Yes, but you shouldn't do it. Seriously. Don't do this, you will
Thank you, Wayne! This helps a lot.
On Nov 4, 2011, at 5:38 PM, Wayne Werner wrote:
> On Fri, Nov 4, 2011 at 4:21 PM, Max S. wrote:
> Is it possible to create a variable with a string held by another variable in
> Python? For example,
>
> >>> var_name = input(&qu
Hi. I'm working on a project for my friend, but I'm running into errors.
No matter what I do, I can't seem to get one method to execute another
method in the same class. Is there a way that I can do this? Thanks.
___
Tutor maillist - Tutor@python.org
Oh. Sorry. It's 500 lines, so I'll just post an example. Windows Vista
and Python 3, just because I forgot.
class K:
def __init__(self): doThis()
def doThis(self): print("Hi.")
k = K()
>From what I understand by your help, the code
class K:
def __init__(self): self.doThis()
def doThis(s
Alt+G, or Edit>Go To Line.
On Thu, Nov 10, 2011 at 1:58 PM, Nathaniel Trujillo
wrote:
> How do I get to line 362 of a program without counting each line ? Thanks
> for the help.
> ___
> Tutor maillist - Tutor@python.org
> To unsubscribe or change sub
Well, I am assuming that by this you mean converting user input into a
string, and then extracting the numerals (0-9) from it. Next time, please
tell us your version of Python. I'll do my best to help with this. You
might try the following:
the_input = input("Insert string here: ") # change to
Hi. I've been using a lot of text files recently, and I'm starting to
worry about a user hacking some element by editing the text files. I know
that I can pickle my data instead, creating less easily editable (try
saying that five times fast) .dat files, but I'd rather store individual
variables
Thank you. This will work perfectly.
On Nov 18, 2011, at 11:58 AM, Prasad, Ramit wrote:
> Hi. I've been using a lot of text files recently, and I'm starting to worry
> about a user hacking some element by editing the text files. I know that I
> can pickle my data instead, creating less easil
In some cases, it is a useful fact that Python only shows error messages when
they are encountered. For example, I can test a program while keeping away
from an area that still doesn't work, rather than having to make it work
flawlessly before my first test.
Python *can* generate executables w
You are using an 'elif' for your 'coin_rolls == 1:'. The 'elif' keyword
means that if the last 'if' statement (and any 'elif's behind it) was *not*
true, only then will it be executed. Your code could be written as 'if
rolls is NOT less than or equal to 100, only then check to see if it is 1
or 2
On Dec 10, 2011, at 12:04 PM, Alan Gauld wrote:
> On 10/12/11 16:46, Steven D'Aprano wrote:
>
>> ...the alternative would also have caught out everybody at some point.
>> Consider a hypothetical Python where mutator methods returned a result:
>>
>> a = [1, 2, 3]
>> b = a.append(4)
>>
>> Does t
I believe that line 3 raises an error. The because you contained the text
in single quotes, and then used the same character in 'you're not chris',
Python believes that you are trying to type "you" re not chris". You can
change the single quotes surrounding your string to double quotes ("you're
n
Could anyone tell me why I should use a .pyc file rather than a .py? After
doing some research, I have found that a .py file is first precompiled and
then run, while a .pyc file is already precompiled and is simply run. But
unless I'm mistaken, it seems that a .pyc is no faster or better than a .
Then if I understand correctly, I work with .py files and (should) run them
as .pyc files?
On Thu, Apr 19, 2012 at 10:55 AM, Russel Winder wrote:
> On Thu, 2012-04-19 at 10:47 -0400, Max S. wrote:
> > Could anyone tell me why I should use a .pyc file rather than a .py?
> After
&g
Hi,
I started learning Python (v3.5) and was given some code samples to assist
in my studies. There are some things I could not figure out using Python
documentation or other online sources. I have experience with SQL
programming and some procedural programming, but little in terms of OOP.
I tr
Hi,
I am a newcomer who asked a first question here at Tutor. Soon I received a
very good answer from a tutor and put an effort to understand it. After
that I wrote a reply with a thank you and a follow-up question, only to
discover that I don’t see a way to send it.
I need to say I did not wri
Hi, everyone whom might read this, im Max and i am really new to coding,
been going at it for about two weeks using codeacademy and the book "think
python".
when i decided to experiment a little with if statements i ran into the
following problem:
def plus(x,y):
if x and y == in
dows
7(64Bit), Windows XP
Python 2.7 and 3.3 64Bit on the Ubuntu box.
Python 2.7 and 3.3 32Bit on the Windows boxes
Thanks;
Max Bedacht
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
on for my
GCSE's if you could give me some tips. I'd be excited to hear.
Thanks very Much,
Max.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
help me it woild be much appreciated
yours sincerely
Max Patient
Sent from my iPhone
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
On Mon, Jul 30, 2018 at 3:20 PM, Sunil Tech wrote:
> Python memory allocation is varying in all these use cases. Please help me
> understand.
CPython is interning small integers and small strings as a form of optimisation.
"The current implementation keeps an array of integer objects for all
int
201 - 296 of 296 matches
Mail list logo