Hi all,
Using Beautiful Soup and regexes.. I've noticed that all the examples
used regexes like so - anchors = parseTree.fetch("a",
{"href":re.compile("pattern")} ) instead of precompiling the pattern.
Myself, I have the following code -
>>> z = []
>>> x = q.findNext("a", {"href":re.compile(".*?
Liam Clarke wrote:
> Hi all,
>
> Using Beautiful Soup and regexes.. I've noticed that all the examples
> used regexes like so - anchors = parseTree.fetch("a",
> {"href":re.compile("pattern")} ) instead of precompiling the pattern.
>
> Myself, I have the following code -
>
z = []
x = q.f
Here is the latest
error:
The Currency Exchange
ProgramBy Nathan Pinno
Traceback (most recent
call last): File "D:\Python24\exchange.py", line 27, in
-toplevel- store = open('exch.txt', 'b')#loadIOError:
invalid mode: b
and the latest
code:
import picklerates
= {'can_us' : 0.80276
On Dec 17, 2005, at 2:00 PM, Nathan Pinno wrote: Here is the latest error: The Currency Exchange ProgramBy Nathan Pinno Traceback (most recent call last): File "D:\Python24\exchange.py", line 27, in -toplevel- store = open('exch.txt', 'b')#loadIOError: invalid mode: b[snip...] store = open('e
I'm working on Exercise 4 from Part 4 from Learning
Python. I'm trying to write a function using **args.
I want to create a function that adds its arguments
together. Here is what I have written:
def adder(**args):
for x in args.keys():
print x
print adder()
print "---"
print adder
Christopher Spears said unto the world upon 2005-12-17 17:42:
> I'm working on Exercise 4 from Part 4 from Learning
> Python. I'm trying to write a function using **args.
> I want to create a function that adds its arguments
> together. Here is what I have written:
>
> def adder(**args):
>
> def adder(**args):
>for x in args.keys():
>print x
A function which doesn't return a value returns None by default.
> print adder()
You are asking Python to print the return value of the function,
which is None.
As a general rule its better to do the printing outside of the functi
I got my function to work! It takes arguments and
adds them:
def adder(**args):
argsList = args.values()
sum = argsList[0]
for x in argsList[1:]:
sum = sum + x
return sum
print adder()
print "---"
print adder(a=5)
print "---"
print adder(a=5,b=6)
print "---"
print adder(a