ng to look like you are one of those.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
t "RT Plan Label\t\t\t\t=\t%s" %RTPlanLabel
print "DoseReference Description\t\t=\t%s" %DoseReferenceDescription
print "Tolerance Table Label\t\t\t=\t%s" %ToleranceTableLabel
print "Number Of Beams\t\t\t\t=\t%i
Please always reply to the list not just me.
Bryan Fodness wrote:
>
> Thanks Bob,
>
> I was having trouble with that loop from the start. Could you tell me
> what a=3 is doing, I cannot seem to figure it out.
I accidentally left that in. It was a place for me to set a bre
bly require another while loop.
Do you use a debugger? It has been very helpful to me in tracking down
the problem. What operating system are you running? What IDE or
development tool are you using?
[snip]
--
Bob Gailer
919-636-4239 Chapel Hill,
Bryan Fodness wrote:
>
> I have not used a debugger yet, I was getting ready to try that. I am
> using IDLE on Windows Vista.
>
Ah. May I recommend Python for Windows. The debugging support is
excellent. I prefer it to IDLE.
http://sourceforge.net/projects/pywin32/
--
Bob Ga
on.
So, I suggest you write a program to:
assign a candidate string to a variable (choose a string that has at
least one letter that "comes after 'm'")
test each character to see if it "comes after 'm'"
print that character
stop
Do as much as you can, and ask more questions.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
>
> OR
>
> b) see if the ascii value of your character is bigger
> than the ascii value of 'm' And you can check the
> ascii value using ord()
>
3rd alternative: if c > 'm': print c
> There are pros and cons to both approaches.
> Pick the one you
; My run time environment is IDLE.
It is more accurate to say "My development environment is IDLE." The
underlying Python interpreter is the runtime.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
[snip]
> I went to the PSPad site, but found no way to download the editor. Am
> I missing something?
Ignore that. Something on the home page did not display correctly.
Refresh fixed that.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
t; them in the python code. Seems ugly.
Would be nice also to see support for GWT (and pyjamas).
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
.
It would have been even nicer if he/she had given the specification the
first time. Would have saved everyone time and helped ensure a quick
and correct answer.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
sent from the server to a browser one result line at a time)
>
> Any savings you have from optimizing this loop will be completely
> swamped by the network time. Why do you think this is a bottleneck?
>
> You could use
> [ sys.stdout.write(some operation o
e evidence?
So does anyone know the command to show after an animation is
over???
Show what?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
919-636-4239 Chapel Hill, NC
d to create all the tables in memory, then run
select cursors to retrieve from the file-based db and insert the rows
into the memory-based db tables
Why do you want it in memory?
[snip]
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
m their customers.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
t be a better way. What is it?
You might read the datetime documentation.
And then notice that date2 - date1 is a timedelta object.
And then look that up to see its attributes (which inculdes days)
And then try print (date2 - date1).days
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Just testing as recently I'm not seeing my posts even though Receive
your own posts to the list? is Yes.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I just changed my email address. Now when I post to tutor@python.org the
posts do not show up. I have checked the mailman settings; they look OK.
Have you any guidance?
Did this post show up on the list?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
Thanks to all. My posts do show up. Now how to get them sent to me???
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
man):
> if iwon !=tie:
> print iwon, "you win!"
> else:
> print "a tie"
>
> def main():
> computer, human = pieces()
> turn = X
> board = newboard()
> createboard(board)
>
> while not winner(board):
> if turn == human:
> move = humanmove(board, human)
> board[move] = human
> else:
> move = computermove(board, computer, human)
> board[move] = computer
> createboard(board)
> turn = whoseturn(turn)
>
> iwon = winner(board)
> whowon(iwon, computer, human)
>
>
> main()
>
>
>
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
a look at the itools.web
examples. I was OK with 13.1 Hello world. Then I hit 13.2 Traversal. The
text on the page leaves me hopelessly lost. Is there any other explanation?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@
enter an expression at the interactive prompt you see the
value. Not true when you run a program. Expression values must be
printed. So you are doing nothing wrong.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ys be 1.
Is that not obvious? Or are you expecting that product and temp both
refer to the same object? Which would be true if the object were a
mutable such as a list or a dict or a class instance. But is NOT the
case for immutables such as numbers and strings.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
for lineno, line in enumerate(html[lineno+1:]):
x = line.find("requests currently being processed")
if x >= 0:
no_connections = line[3:x]
That makes certain assumptions about the file format, such as the
matching text and knowing that connections follows requests/sec, and
does not assume that connections is the first line after requests/sec.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
x = html[lineno].find("requests/sec")
if x >= 0:
no_requests_sec = html[lineno].[3:x]
break
for lineno in range(lineno, len(html)):
x = html[lineno].find("requests currently being processed")
if x >= 0:
no_connections = html[linen
help me understand this". Even the sample code is
confusing.
Is there some other documentation or example?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Kent Johnson wrote:
On Wed, Apr 23, 2008 at 9:46 AM, bob gailer <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Evey time someone recommends Queue I think "oh boy this will
really help me". Then I go to the Library Reference, read the
Queue docs and thin
%s is %s and %s' % (i, j, norm_ted)
sum_norm_ted = sum_norm_ted + norm_ted
print 'sum_norm_ted %s %s is %s' % (i, j, sum_norm_ted)
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Kriti Satija wrote:
Please unsubscribe my membership from python tutorlist.
Only you can do that. Visit http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http
m>
--------
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
print line
f.close()
The file.txt looks like
1
2
3
4
5
I would like the code to output "4"
but I don't know how to use the next. Are there any other way?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
That sounds like irony. Somehow not suitable for this list or for
someone seeking help as to how to unsubscribe.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
this if you want less lines of code:
f = open('file.txt',r).readlines()
print f[[x+1 for x,line in enumerate(f) if line.rstrip() == "3"][0]]
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
bob gailer wrote:
Or even simplre
f = open('file.txt',r).readlines()
print [f[x+1] for x, line in enumerate(f) if line.rstrip() == "3"][0]
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
ht
reter.
Pray tell, why?
Try
>>> import program
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
dictionary or list have
to be locked while reading?
http://www.python.org/doc/faq/library/#what-kinds-of-global-value-mutation-are-thread-safe
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
ple 'losetup -a'
would be like this:
[EMAIL PROTECTED] Desktop]# losetup -a
/dev/loop0: [fd00]:11305639 (enc)
/dev/loop1: [fd00]:11306533 (/home/nmcbride/Desktop/xxx.iso)
Can anyone give me a hand?
I for one have no idea how this relates to Python. If others do then
they
Spencer Parker wrote:
here is the code:
http://dpaste.com/48734/
Please show us the traceback.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ocs.python.org/tut/node16.html.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
using the decimal module
http://docs.python.org/lib/module-decimal.html
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
27;end':
datetime.date(1216, 9, 30), 'start': datetime.date(1216, 9, 28),
'long-name': u'Lincoln, Lincolnshire.'}
{'placename': u'Lincoln, Lincolnshire', 'processed': True, 'end':
datetime.date(1216, 10, 2), 'start': datetime.date(1216, 10, 1),
'long-name': u'Lincoln, Lincolnshire.'}
But if I try to call events() thus:
for x in events(lst):
if x['processed'] == True:
print x
I get a KeyError.
Sounds like the key 'processed' is created by the assignment
x['processed'] = True. So those dictionaries that have not experienced
this assignment have no such key. You should instead use: if
'processed' in x:
Also if x['processed'] == True: can be expressed if x['processed']:
HTH
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
4A):[c,d], (2,23A):[a], (2,24A):[a,c,d]}
That gives a syntax error at the first A.
And the rest of the code lacks indentation.
Your code does not match your specification. You said "... if it finds
the value 'a' in the values of the key" but you test
if
.
Some articles talk about using cmp, and others about the eq...its a
little confusing :-(
AFAIK either approach is OK. No advantages. (Other than writing one
method vs 2).
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor
Content-Type: text/plain; charset=US-ASCII
Hi all,
How do I replace the same value multiple times without repeating the
same variable name/value repeatedly?
for ex.
some = 'thing'
print '%s %s %s %s' % (some,some,some,some)
in this case, my question is how do i replace "% (some,some,some)" with
something more concise?
re_new(_stext_1,_rtext_1,record) #if found first then replaceit
re_new(_stext_2,_rtext_2,record) #else if found second then
replace that
Will you please help me to correct this script so as to both of the
changes occure at a singlr time
Thanks for past, now a
Content-Type: text/plain; charset=US-ASCII
Hi all,
How do I replace the same value multiple times without repeating the
same variable name/value repeatedly?
for ex.
some = 'thing'
print '%s %s %s %s' % (some,some,some,some)
in this case, my question is how do i replace "% (some,some,some)" with
something more concise?
ome)" with
something more concise?
The tersest I can offer is:
print '%s %s %s %s' % ((some,)*4)
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
either GET or POST. Examine the HTML of the form
to see which.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Dick Moores wrote:
I've been using Ulipad, a free IDE mainly for Python, and written in
wxPython, for a couple of years, and think it's terrific.
Thanks - IUlipad has some nice features, but I'd miss the debugging in
PythonWin.
--
Bob Gailer
919-636-4239
u run this program?
When I do I get:
File "J:\pipelines\cubed.py", line 11, in
if isCube(soma):
NameError: name 'isCube' is not defined
When I examine the program I'm not surprised to get that exception.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
__
(cubed_root - round(cubed_root)) < .01: # this is a
guess at close enough, and cheaper than cubing?
print i
print j
print soma
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
h
Did you see my comments and questions?
Please fix the spelling error (iscube vs isCube).
And tell us what results you are expecting, and what results you are
getting. Nunbers rather than "wrong"!
Otherwise we can't help
--
Bob Gailer
919-636-4239
that .dog. and .rat. meet the
criteria and list them.
How would you do it?
And how does this question relate to Python?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ine.split('\\'))
Even more concise and possibly faster:
data = open('out.out').read().replace('\n', '\\').split('\\')
a = array(data)
a.shape = (384, 512)
Kent
_______
hat he thought the
user wanted.
Precise specification helps ensure desired results. Even in human
relationships!
OK - what next? How do you react to what I said?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
If the above is intended to be Python code, it has problems.
Rewrite it thusly?:
data = [ '33386.472.22-1.11 0.43',
'33386.67 3.33 -1.23 0.54',
# ...
'46728.470.1-1.87-0.54',
'46728.479.75.680.38',
'46729.
us an example of how you'd use try-except in your
parser?
Also are you aware that there are a lot of parser programs out there
(some in Python) that might save you time / effort?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist -
n textdata.split('\n'):
if line:
tag, content = line.split(' ', 1)
if tag == "question":
questionary.append({tag : content})
else:
questionary[-1].update({tag : content})
You might even cons
e data, but also not assigned an object name
so am I right in thinking that as the object is 'reclaimed' close() is
automatically called ?
True. And not, imho, "bad programming"
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
yntax is more like foreach in PHP..
for item in somearray[1:]:
print i
I've tried this to no avail
count = 0
for i in range(1,10):
if count == 0:
continue
else:
count += 1
print i
continue
it prints absolutely nothing.
--
Bob Gailer
919-6
while count2 !=5:
number=randrange(55)+1
if number in win:
numbers.append(number)
else:
print "lose"
break
numbers.sort()
ball=randrange(42)+1
if ball==powerball:
print "win"
print
print
print win, powerball
--
sually a LOT shorter.
(3) Python is "lighter" than Java (and C, C++, VB, most other languages)
(4) Python comes with a large library of modules that support almost
anything you'd want to accomplish.
HTH
--
Bob Gailer
919-636-4239 Chapel Hill, NC
amit sethi wrote:
Hi , Could you please tell me , how i can traverse a two dimensional
array , i am sorry , it must be pretty simple but I am new to python
am not able to understand.
How did you create the array?
How have you tried to traverse it?
What do you mean by traverse?
--
Bob
in the line
if in dictionary replace with corresponding value
write line to output.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
you get the same outcome. If you do then let's examine
how your program differs.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
description of rooms and flow
between rooms) from the program logic.
This makes things a LOT easier.
There are more complicated structures in Python that make game
programming a LOT easier and more flexible that the above.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
.", "Pick a direction", n=4, s=5)
chapters[4] = Chapter("It's cold in here.", "Pick a direction", e=1, w=2)
chapters[5] = Chapter("It's hot in here.", "Pick a direction", u=6, d=3)
chapters[6] = Chapter("Congratulations - you found the
bob gailer wrote:
Jacqui wrote:
Hi, I'm a total newbie too, and I'm kind of replying to see if my
instinct on the whole GOTO thing is correct. It's hard to learn a
language without any feedback!
I used GW and Color Basic when I was a kid so I know all about GOTO (and
i
erence comes in handy:
print_stmt ::= "print" ( [expression ("," expression)* [","]]
expression_list ::= expression ( "," expression )* [","] # An expression
list containing at least one comma yields a tuple
Given that, there is no ambiguity in p
python.org
http://mail.python.org/mailman/listinfo/tutor
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
nic way. Have you considered using a
RamDisk? http://en.wikipedia.org/wiki/RAM_disk for general details.
http://www.codeguru.com/cpp/w-p/system/devicedriverdevelopment/article.php/c5789/
for a Windows Ram Disk driver installer. I just tried it - it works like
a charm.
HTH
Monika Jisswel wrote:
You know bob, you are very clever
Yes. I've observed that before.
, I have used RAM disk for realtime recording of audio before but it
never occured to me to use it for light jobs like this one, I just
compeletely ignored it as an option & by the way this ope
ire30,),
Remove the trailing , in the last line. It is causing myString to be a
tuple.
Of course in this scenario, the variables in the parenthesis are
strings with newlines in them. But when I do a 'print myString', it
shows everything in one line, including the '\n' charac
james collins wrote:
how do i unsiscribe from the mailing list?
Follow the link below
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ectory".
If that is the case there are several solutions.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Monika Jisswel wrote:
list comprehention : [ x for x in LIST if x != '' ]
or just [ x for x in LIST if x ]
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
direction?
See the new module's instancemethod method.
>>> import new
>>> class A:
... pass
...
>>> a=A()
>>> a.f = new.instancemethod(lambda self:'foo', a, A)
>>> a.f()
'foo'
--
Bob Gailer
919-636-4239 Chapel Hill, NC
__
x27;15', '16', '17', '18', '19',
'21', '22', '23', '24', '25', '26', '27', '28', '29']
which I had expected.
Give us an example of text for which it does not work.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ike this:
test = ['one', 'two', 'three\nfour', 'five', 'six', 'seven\neight',
'nine']
That showed me that I needed to step one extra item, in order to reach
the next item that needed to be split. My brain still hurts.
E
On
uding strings, tuples, lists, dictionaries, sets and
frozensets). All other values are interpreted as true."
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
suggestion consider:
def foo(parameter, *args)
args will be a tuple with 0, 1 or more items in it.
So you can test for len(args) == 1
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ort 80
can you tell me what is meaning of this error
Note it says "More information about this error may be available in the
server error log". Take a look at the log.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor
.
---
I think that assignment is very poorly worded!
Why the busywork of coming up with 100 real dates. What does that have
to do with programming?
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
. The concept does not
apply to other forms of strings.
>>> x = r"\t"
>>> x
'\\t'
I'm guessing you want
>>> x.raw() # to display
r"\t"
Is that true. That's the only way I can interpret your quest
s
Assume symbol = "foo" and stat = "bar".
Then url = 'http://finance.yahoo.com/d/quotes.csv?s=foo&f=bar
<http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s>
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tut
', 'rb')
>>> f.read()
'this line contains as\r\nbut this has as\r\n'
[snip]
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
what
you use to see if a file exists.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
dow flash ever so briefly? Try adding raw_input("press any key to
exit") at the end of your program. Of course that will work only if
there are no errors in the program.
Best way for now is from the command prompt (like "c:\\python25\\python
test.py")
--
Bob Gaile
m of the latter is
a link
"The
Art Of Computer Programming: Pre-Fascicle 3A, A DRAFT OF SECTION
7.2.1.3: GENERATING ALL COMBINATIONS" by Donald E. Knuth (compressed
postscript file)
I have not examined that but it seems to be what you want.
--
Bob Gailer
919
ills.
Of the 4 or 5 replies i think that you would be most help.
We all can help.
AND PLEASE as I asked, reply to the list not just me.
--
Bob Gailer
919-636-4239 Chapel Hill, NC
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
t in the Fibonacci series is an even number. So one
could economize slightly:
def sumEvenFibonacci(limit):
a, b = 1, 1 # don't waste with a = 0
sum = 0
while b < limit:
a, b = b, a + b
sum += b
a, b = b, a + b
a, b = b, a + b
return sum
--
Bo
len(rec.split()),
'lines' : lambda rec, tot: tot + 1,
'minline' :lambda rec, tot: min(len(rec), tot),
'maxline' :lambda rec, tot: max(len(rec), tot),
}
Consider how many more lines of code it would take if I had to use defs.
Consider how reada
rint "Goodbye!"
Consider leveraging the dictionary (and some other"Pythonic"
refinements). Separate the logic from the data. Now you can add more
names and ages without changing the logic.
#!/usr/bin/python
person = {'Lary':43, 'Joan':24, 'Bob'
Christopher Spears wrote:
Hey,
I'm working on a problem out of Core Python Programming (2nd Edition).
Basically, I'm creating a class that formats dates. Here is what I have so far:
Consider reformatting the month_dict so each name and abbreviation is a
key. Then you can just look up th
OkaMthembo wrote:
Hi there,
I just came across something called the Global Interpreter Lock, and
apparently its a condition where an interpreter locks resources to
avoid sharing them with other apps/ processes on the system? I wish to
find out what this means in terms of Python. for example do
Marc Rambert wrote:
hi,
I would like to make some regular expression, unfortunately I can't
because the backslash doesn't work
Please explain "doesn't work".
I interpret that as "I press the \ key and nothing shows up in the
active window."
--
Bob
.
I interpret that as "I press the \ key and nothing shows up in the
active window."
hi yes you are right and this is when I am in french keyboard.
I can't help here but perhaps someone else can.
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware
72 and n2 >= 16 and n2 <= 31)):
lines[i] = r.sub("xxx.xxx.xxx.xxx",lines[i]) # using sub is a
little more compact
Check out the python regular _expression_ howto -
http://www.amk.ca/python/howto/regex/
Greg
___
Tutor maillist -
spe/?abmode=1 looks more promising!
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interatctions with others.
Nonviolent Communication provides tools for this awareness.
As a coach and trainer I can assist you in le
video) 15 seconds to start
(each time it is requested)! Since I depend heavily on the debugger that
delay would drive me crazy!
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interatctions with others.
Nonv
801 - 900 of 2074 matches
Mail list logo