is on a suse linux 10 box
--
Bob Rea
mailto:pet...@petard.us
http://www.petard.us
http://www.petard.us/blog
http://www.petard.us/gallery
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
way through _Making Use of Python_ by Rashi
Gupta. I am using Python 2.4.1
I have run into problems in a script, listed at
http://python.pastebin.com/m51bc3388
If I input my own name and dob, it works:
b...@gandalf:~/python/MakingUse/Chapter05> python code1.py
Enter your first name: Bob
Enter yo
On Tue June 30 2009 3:20 pm, you wrote:
> On Tue, Jun 30, 2009 at 1:06 PM, Bob Rea
wrote:
> >
> > If I input my own name and dob, it works:
> > b...@gandalf:~/python/MakingUse/Chapter05> python
> > code1.py Enter your first name: Bob
> > Enter your last nam
print "Password Confirmed"
2 ways - either
1.
while count != 3 and guess != password:
or
11. print "Password Confirmed"
12. break
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
both reduce and scan, where scan gives you exactly what you
want. WIBNI Python had scan?
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
call chain.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
e0> (retention: 1 day)
Could I have used dictionaries instead, with the denomination names
as keys? Is it possible to guarantee a sequence in which the keys
of a dictionary are iterated through? (If not, I suppose I could
keep the list 'denom' as it is here, and iterate through it with
"for key in denom:", although this seems a bit redundant.)
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
27;pennies')
amnt = 99
buff = []
for coin in coins:
(coin.count, amnt) = divmod(amnt, coin.value)
d = coin.display()
if d:
buff.append(d)
if len(buff) < 2:
print buff
else:
print ', '.join(buff[:-1]) + " and " + buff[-1]
--
Bob Gailer
Chapel Hill NC
919-636-4239
__
ne?, don't.
Please show us more of the program, including the import statement(s),
and some sample input data. What leads you to think is is slow?
One opportunity for improvement - take the invariant out of the while
statement.
q = dt.datetime(*X[-1,0].timetuple()[0:4])
wh
51, 2: 42}
In [5]:
_______
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ion includes Python, web servers, HTML. Have
you asked the question in other fora?
Is there a link to this and prior problems that we can visit?
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
mean dict['int'] = list[-1]?
You should also avoid shadowing built-in names like "list", "dict",
"file" etc as you can very easily end up with unexplained errors.
Hope that helps.
--
Bob Gailer
Chapel Hill NC
919-636-4239
_
ting
variable names. Preferred is a dictionary.
names = {} # empty dictionary
name=raw_input()
names[name]=zeroes((3,3))
print names["Chris"]
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
evolve beyond simple command
line interfaces. At that point dealing with dynamically created names
becomes a pain.
With a little finessing you can create a class instance with attributes
that are names such as Chris. Then you could
>>> print c.Chris
--
Bob Gaile
t process all the scores before computing averages. This means
saving each player's score.
Use a dictionary with the name as the key and the score as the value.
Then go thru the dictionary to compute and report averages.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
* 50) + "\n")
for name, score in scores.items():
if score == 300:
score = "\tPerfect score!"
elif score < averageScore:
score = "\tBelow average"
elif score > averageScore:
score = "\tAbove averag
fraction)*red1 + fraction*red2
g = (1-fraction)*green1 + fraction*green2
b = (1-fraction)*blue1 + fraction*blue2
print ' "
The output of that is (e.g.)
print ""
--------
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Python programs (as it should).
What happens if you open a CMD window, run program 1, close CMD window,
and repeat for the other programs?
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
committees
- campaign committees can file multiple reports
I'm trying to pull these records from a database and output them to an
HTML file in sorted order.
I suggest using the ORDER BY SQL Clause rather than trying to sort it in
Python.
[snip]
--
Bob Gailer
Chapel Hill
u know how to print a line?
what is the criteria for determining A, B C, D, or F average?
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
substitutions.
Which could be applied to all the 1 character substitutions after
dealing with the multi-character ones.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ll i
am not getting.
Amrita Kumari
Research Fellow
IISER Mohali
Chandigarh
INDIA
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
: # N and CA values
missing
print "all missing", line
else:
print "C missing", line
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
gal parameter (%s)" % parameter
check_command()
# end code ---
cmds is a list similar to:
[('bletch', ),
('foo', ),
('romans', ),
('stilton', )]
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Albert-Jan Roskam wrote:
Hi Bob,
Very neat solution, thanks a lot! I didn't know the inspect module, but it's just what's needed here. Cool!
Great.
Regarding the ordering of functions in the list - variable names in
namespaces (such as modules) are stored in dictionaries.
write many many modules.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
nced
Choose open
Click Edit
in my system I see "H:\Python30\python.exe" "%1" %*
which means fire up python.exe, pass the dropped file name as the first
argument.
BTW a nice 1 python line version independent droplet:
#!/usr/bin/env python
# encoding: utf-8
input(__import__('
Albert-Jan Roskam wrote:
Hi Bob,
Sorry for the late reply, but thank you for your code. I still haven't
completely wrappped my brain around decorator functions, but thanks to your
reply at least now my frontal lobe is touching it. ;-)
Decorator functions:
def collect(func
Kent Johnson wrote:
On Tue, Aug 11, 2009 at 10:22 AM, bob gailer wrote:
Decorator functions:
def collect(func):
'a "decorator" that adds each function to the cmds list'
cmds.append((func.__name__, func))
Decorators must return a callable
The docs inde
rt with
uppercase characters, all remaining cased characters are lowercase."
It depends on the definition of "word".
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ny definition for func0 in the above snippet. Where is
it defined?
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tut
r grouping conceptually related classes that don't share
attributes?).
Or is it typically better to keep all classes on the same level of a
heirarchy, and then just use inheritance to establish parent-child
relationships where appropriate?
--
Bob Gailer
Chapel Hill
GoodPotatoes wrote:
I'm not sure if I've been searching using the correct terms. After
I've iterated through an object, such as a cursor or webpage, how do I
get back to the "top"?
e.g.
tutorial from http://www.daniweb.com/code/snippet563.html#
print page1.readlines()
Capture the lines in
t connection that listens, and have your
application periodically connect to the socket, at which point the
"application which data I'm accessing" will return the changes.
3) using pywin32 make it a COM server. Your application will establish a
COM connection to it and reque
Python. I just went through some Ruby tutorials. I see some neat things,
but in general it seems that Ruby requires more keyboard activity
(typing) to get the same result. I will stick with Python. But then
there are those who stick with COBOL, so who knows the truth?
--
Bob Gailer
Chapel
In Python they are for or while,
not if.
Also realize the above, when converted to a while loop will never
terminate, since i keeps growing.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change su
I kinda get it, the thing that warps my brain is the idea that there are
more than 2 lists now to test against eventually my script needs to
accommodate 4, 5, 6 sets.. but i would just like to see if i can get 3
sets to work first.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Joshua Harper wrote:
I just bought an arduino and id like to use python instead of the
arduino language, any tips, tutorials, anything, i googled but there
isnt much on it really..
about 3,000,000 results?
--
Bob Gailer
Chapel Hill NC
919-636-4239
as it
used in this instance?
It simplifies coding, as it takes care of initializing each new entry to
a list.
On Sep 6, 2009, at 3:06 AM, bob gailer wrote:
I want to be able to look at a number/item and see which lists it is
in so that i could maybe have a master list of all the data, a
sup
, tuple2
You probably want something different. So explain please.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ssible deck of cards or suits.Ac
Ah
As
Ad
2d
3d
4d
5d
6d
7d
8d
9d
10d
Jd
Qd
Kd
also note that you can use strings instead of tuples: (using T instead
of 10)
values = "A23456789TJQK"
suits = "chsd"
OR
values = "A 2 3 4 5 6 7 8 9 10 J Q K".split()
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Sorry - I can't explain that. But consider a simplified program:
total = 0
count = 0
line = input()
while line:
if line.isdigit():
number = int(line)
total += number
count += 1
else:
print( "BLARGH : ", err )
line = input()
if count:
print(
)
wanted = (data2)
If you are concerned about enough memory, write data2 to the file
instead of collecting in a list.
f3.append(wanted + "\n")
Drop next line:
i += 3
f4 = open('wanted.txt', 'w')
f4.write(''.join(f3))
f2.clos
tuple of lines: (untested)
a=f2.readline()
if not a: break
b=f2.readline()
c=f2.readline()
lines = (a,b,c)
iterate over the lines and their respective slices:
data2 = []
for x in range(len(lines)):
for s in slices[x]:
data2.append(lines[x][s].strip()
OV
2009/9/15 bob gai
------
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
win32/Build%20214/pywin32-214.win32-py2.6.exe/download
import wincom32.client
com = wincom32.client.Dispatch( application name or classid of the
vb.net app)
# now you have a com object with which you can send commands to the
vb.net app and receive data back.
--
Bob Gailer
Chapel Hill NC
919-636
,
line 157, in monsAttk
playHp -= damage
UnboundLocalError: local variable 'playHp' referenced before
assignment
If you could please help me, that would be great. I'm just trying to
get the game engine working, as of now, it is 30% done, with
Inventory, Equipment,
u try to run it? That is step one.
Try to run it. See if you can figure out why it fails. Hint there are 2
syntax errors.
At python.org there are links to several tutorials which will show you
how to repeat operations.
To repeat things in Python we can use a loop. What Python statements are
e temp.txt")
I wonder if that possible to execute this script (called application)
without writing the file with initial data to the hard disk?
Take a look at os.system()
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@pytho
g problem if the goal is to get to the
truth." -Dr. Steven Hyman, Harvard
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
sticky = W)
root.mainloop()
Does anyone know how to solve this issue? Anyone know if this is a bug being
worked on?
Thanks,
--Bob
_
Hotmail: Powerful Free email with security by Micro
button(root, text = "Test RadioButton 2", variable=v,
value="2").grid(row = 1, column = 0, sticky = W)
root.mainloop()
Any ideas on how to have a StringVar() associated with a group of Radiobutton
objects where all of the radio buttons start off unselected?
--Bob
> Da
is a bug in tkinter for Python 3? (I know when
using an IntVar, you don't need to do this). Is this the best solution for now?
Thanks,
--Bob
_
to remove ^M from the end of
every line. Though it is not shown while programming but I can see
that when I run my scripts on debian linux environment & thus get errors.
I don't understand. Please explain.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
hrough all of the values of the properties tuple
and get each value?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
tr__
raise AttributeError
AttributeError
My previous suggestion was assuming that elements of myuser.properties
were strings (names of the properties). If instead they are the
properties then you'd
print x
--
Bob Gailer
Chapel Hill NC
919-636-4239
_
(packed_XorKey))]
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
immutable. Replace them with lists and voila. l1=[[0,0]] * 4
But also realize that you are creating a list with 4 copies of one
object [0,0]. Assigning to one changes all!
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@pyt
the envelope now?
Instead of printing from left to right on the long side of
a #10 envelope, I wish to print sideway, printing from the
left short edge of envelope to its right short edge.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist
.
How do you communicate from Python to these programs?
Instead of printing from left to right on the long side of
a #10 envelope, I wish to print sideway, printing from the
left short edge of envelope to its right short edge.
--
Bob Gailer
Chapel Hill NC
919-636-4239
Lie Ryan wrote:
Ajith Gopinath wrote:
Thanks folks.
|| a j i t ||
On Sat, Nov 7, 2009 at 7:49 AM, bob gailer <mailto:bgai...@gmail.com>> wrote:
Shashwat Anand wrote:
@Bob: the solution seems promising, and it's fast. Thanks for
the improvement. However I
sed your point, I understood it. So your explanation
was OK (for me).
print getattr(features, a)
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
many algorithms
for this - you might consult Wikipedia for ideas.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
range(2, primeCandidate):
if primeCandidate % x == 0:
print primeCandidate, "equals", x, "*", primeCandidate/x
isPrime = False
Print primeCandidate
break
If isPrime:
primeCount = primeCount + 2
Print primeCandidate
ank?
Better logic:
# open files
paragraph = []
keep = True
for line in fileIn:
if line.isspace(): # end of paragraph
if keep:
outFile.writelines(paragraph)
paragraph = []
keep = True
else:
if keep:
if line == '\tfoo':
keep = False
else:
paragraph.appe
re. No? or
is there anything that I don't get?
I think the test should be:
if not line.isspace and 'foo' not in line:
fileOut.write(line)
No - that misses the objective of eliminating blocks containing 'foo'
--
Bob Gailer
Chapel Hill NC
919-636-4239
__
Antonio de la Fuente wrote:
* bob gailer [2009-11-17 15:26:20 -0500]:
Date: Tue, 17 Nov 2009 15:26:20 -0500
From: bob gailer
To: Antonio de la Fuente
CC: Python Tutor mailing list
Subject: Re: [Tutor] Introduction - log exercise
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812
e a specification of the algorithm. What is is to
do. Saves me a lot of time trying to decipher the code.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.
not defined
What it does is alert the compiler that assignment to the variable will
make it global.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
e target (which, unlike normal
assignment statements, cannot be an unpacking) and the expression list,
performs the binary operation specific to the type of assignment on the
two operands, and assigns the result to the original target."
--
Bob Gailer
Chapel
th()
def __sub__(self, right):
return Vector(self.x - right.x, self.y - right.y, self.z - right.z)
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
after the simulation run?
How precise do the numbers have to be?
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
tements.
I don't see in Perl generators, comprehensions, generator expressions,
with statement, threading.
Exception handling seems limited.
I think the syntax is ugly.
- Fits in your head - what does that mean?
- Batteries included - what does that mean?
- Large library(Cheese Shop) - does Perl also
ue? I'm sure others need to
set properties in com objects.
BTW does anyone know of a win32com forum or list?
There is python-wi...@python.org
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
se page 12839')
--
Криле имат само тия, дето дето сърцето им иска да лети !
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
Chapel Hill NC
919-636-4239
__
/search/
I do not understand what I see on this site or how to use it. Are there
any instructions?
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org
erm is for
sub-variables? Is there a way to make your own classes restricted
like that?
Classes, instances, functions may have user-defined attributes. Built-in
data types such as list may not. Hence the need to subclass (e.g. list)
to add additional attributes.
--
Bob Gailer
Chapel Hill
lWords)
wordDict = collections.defaultdict(list)
for word in uniqueOriginalWords:
wordDict[devowel(word)].append(word)
for lex, wordList in wordDict.iteritems():
print lex, " ".join(wordList)
main()
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
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
It might help us help you if you tell us a bit more about what you want
to accomplish.
--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman
external interpreter
File "C:\Python31\Lib\fractions.py", line 100, in __new__
raise TypeError("argument should be a string "
builtins.TypeError: argument should be a string or a Rational instance
But what does work?
Fraction(str(random())).limit_denominator
very slow.
Suggestions:
Translate the values to integer outside the comparison loop.
Test for >= lower value and <= upper value. xrange is overkill. Be aware
of Python's shortcut:
lower <= x <= upper.
Use:
for m in f1:
...
for j in f2:
ous to a relatively new Pythoneer.
Bob Gailer
[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor
ed ones to debrief the holidays in this light
and to create next year's in a way that is more satisfying,
Bob Gailer
[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Jacob:
Age: 50 (ooh, I don't feel "that" old :-)
Status: Married for 25 years (last Sept).
Kids: 5 (all adopted) - ages: 20, 18, 6.5, 6.5, 6.5
Languages: "American" English only
Programming
Languages: (note, some are "forgotten" - i.e., haven't used in > 10 years)
--
cess! I highly recommend it. www.cnvc.org.
Bob Gailer
[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Bill:
Could you have the "LineEdit#" be your sortable field? If each # after the "LineEdit" prefix were the same length, then you could easily sort on it.
Bob
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Bill:
Sometimes seeing something simple like this can make all the difference. Glad to be able to help.
Bob
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
At 04:48 PM 1/12/2005, Kent Johnson wrote:
If you mean for j to be a list of foobar(item) then use
j=[foobar(item) for item in x]
The first part of the list comp can be any valid expression.
Does that mean that there are invalid expressions? I'd enjoy seeing an
example.
Bob Gailer
mailto:[
At 07:05 PM 1/12/2005, Kent Johnson wrote:
I suppose if it's an expression, it must be valid, eh? Otherwise it's
something else.
At 06:41 PM 1/12/2005, Max Noel wrote:
On Jan 13, 2005, at 01:13, Bob Gailer wrote:
At 04:48 PM 1/12/2005, Kent Johnson wrote:
If you mean for j to be a list
inds me of a proposal a long time ago for a COME FROM statement in FORTRAN.
Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ice that he's never gonna go jogging if the weather is
bad?
Unless I've got input() wrong, it only takes integers...
?
From the docs:
input( [prompt])
Equivalent to eval(raw_input(prompt)).
Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
__
'd' : lambda: pass }
ftable.get(var, lambda: print 'default case')()
From the docs: lambda arguments: expression
print 'a' is not an expression
File "C:\scratch\Script1.py", line 2
ftable = { 'a' : lambda: print 'a',
st the expressions:
ftable = { 'a' : 'a',
'b' : 'b or c',
'c' : 'b or c',
'd' : ''}
print ftable.get(var, 'default case')
Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
in cols:
ts = line[0]
# print line[0]
pe = line[1]
# print line[1]
print """
Timestep PE"""
print "%s %s " % (ts,pe)
outp.close()
Put the print statement in the for loop.
for line in cols:
...
prin
kill everyone in this room
for a drop of sweet beer."
Homer Simpson
__
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
___
Tutor maillist - Tutor@python.org
http://mail.python
ies the list
each time you invoke it.
But when the default value for 'L' is none, the 'if' never catches?
How is this possible?
Or even consider the example given -
def f(a, L=None):
if L is None:
L = []
L.append(a)
return L
How is 'L == None' even possible
arted acting funny. I had
to reboot it.. First I knew of the problem was when I saw the posting you
are referring to. Perhaps my box has a virus.
Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
x27;s blind spots.
Bob Gailer
mailto:[EMAIL PROTECTED]
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
At 08:52 AM 2/11/2005, Mark Brown wrote:
Hi,
I'm a newbie and was wondering which of these IF conditions is better
structure:
if not os.path.exists('filename'):
IMHO the above is preferable to the below. It is much more
"intuitive".
if os.path.exists('filename
301 - 400 of 2074 matches
Mail list logo