k
The 3rd alternative is to use regular expression matching. That is beyond
the scope of this thread.
[snip]
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
p/' + pdf
try: # report and skip bad urls
pn = urllib2.urlopen(url)
except:
print "Bad url:", url
continue
p = pn.read()
z = file(outfile, 'wb')
z.write(p)
z.close()
BTW if you answered YES to the "What!" question you got "Congratulations -
you just killed a bear."
Bob Gailer
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
gt;and I have a hard time keeping them straight. I'm pretty sure I knew
>the answer to this and now cannot find it anywhere (even googling
>through my old tutor posts!)
>
>Does anyone have a quick answer/pointer?
Try the unicode() built-in function. Read the file into a variable, app
cision can caus cumulative errors. Example:
>>> i = 0.0
>>> for j in range(10):i += j*.1
>>> i
4.5009
If you have Python 2.4 + the decimal module may give you what you need.
Bob Gailer
303 442 2625 home
720 938 2625 cell
_
At 11:17 AM 8/18/2005, Nathan Pinno wrote:
>I want to use it for a currency exchange program. It's useful, then the user
>wouldn't have to round it himself/herself, and mistakes could be avoided.
That is what the decimal module is for. I suggest you use it.
Bob Gailer
303 442 2
subscribe. Click
>http://mail.python.org/mailman/listinfo/tutor
and look for unsubscribe under the subscribe section.
Bob Gailer
303 442 2625 home
720 938 2625 cell
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Your new line of data with the time stamp goes here.\n" +
>filedata
>file = open("datafile.txt", "w")
>file.write(newLine)
>file.close()
or if you like terseness:
newText = newLine + open("datafile.txt", "r").read()
open("datafile.txt&
he string
assemble a new string consisting of:
the original string up to the location (index) of "something"
"what"
the rest of the original string
write the new string to the file
Bob Gailer
303 442 2625 home
720 938 2625 cell
_
At 10:12 AM 9/15/2005, Christopher Arndt wrote:
Hi,I wonder if there is a
shorter form of the following idiom:list1 = []list2 = []for item
in original_list: if condition(item):
list1.append(item) else:
list2.append(item)Consider (5 lines instead of 7):lists
= [[], []]for it
s.
Is this new behavior in Activstate 2.4, or do I need
to set an environment variable?
Bob
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
r script (0 = okay,
other = problem).
sys.path is an attribute (of type list) of sys not a function.
So don't put () after path.
I hope it will help.
Damien.
Bob Nienhuis wrote:
Working my way through Alan Gauld's tutorial, and I am on
the
section on modules.
When I call:
import sys
sys
24\Lib\site-packages\pythonwin\pywin\framework\interact.py", line 257, in runcode
exec code in self.globals, self.locals
File "", line 1, in ?
SystemExit
sys.exit(0)
>>> On 9/21/05, Bob Nienhuis <[EMAIL PROTECTED]> wrote:
When I do:
import sys
sys.exit(0)
I
bad HTML can define the same
#attribute multiple times.
self._getAttrMap()
if self.attrMap.has_key(key):
del self.attrMap[key]
--
Bob Tanner <[EMAIL PROTECTED]> | Phone : (952)943-8700
http://www.real-time.com, Minnesota, Linux | Fax : (
Bob Tanner wrote:
> I'd like to delete an attribute of tag, the BGCOLOR to the BODY tag to be
> exact.
I believe I answered my own question. Looking for confirmation this is the
"right" solution.
del(soup.body['bgcolor'])
--
Bob Tanner <[EMAIL PROTECTED]
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Is there a way to insert a node with Beautiful Soup?
I found away to append "things". But
Blah
Foo!
I'd like to insert a tag, like this:
Blah
Foo!
-
parsing of the html.
--
Bob Tanner <[EMAIL PROTECTED]> | Phone : (952)943-8700
http://www.real-time.com, Minnesota, Linux | Fax : (952)943-8500
Key fingerprint = AB15 0BDF BCDE 4369 5B42 1973 7CF1 A709 2CC1 B288
___
Tutor maillist
ot()
>>> print root.find('html/body')
None
>>> print root.find('body')
None
>>>
Viewing the html under firefox DOM tool
-#document
-HTML
+HEAD
#TEXT
+BODY
No sure how to use the find.
--
Bob Tanner <[EMAIL PROTECTED]>
ntry is convertible.:
available_points = MAX_POINTS - sum(points)
print "You have " + available_points + " available."
for x in range(len(attributes)):
cvalue = raw_input("How much would you like to assign to " + attributes[x] + " ?: "))
if cvalue.isdigit():
t;,attributes[x], points[x]
To assign values. Note I separated getting input from converting it to
integer so we can see if the user's entry is convertible.:
available_points = MAX_POINTS - sum(points)
print "You have " + available_points + " available."
for x in range(len(
While following a tutorial on how to create a simple chat server I stumbled upon this problem:
AttributeError: ChatServer instance has no attribute 'decriptors'
here is my code:
#...
import socket
import select
class
Alan Gauld wrote:
> Hi Ben,
>
>
>> I want to enter the words and definitions from the text file into the
>> dict.
>> The way the text file is set up is that one line is the word and the
>> next line is the definition.
>>
>
>
>> I tried using a for loop like this
>>
>> f = open('glos
Bob Gailer wrote:
> Alan Gauld wrote:
>
>> Hi Ben,
>>
>>
>>
>>> I want to enter the words and definitions from the text file into the
>>> dict.
>>> The way the text file is set up is that one
Ben Markwell wrote:
>
>
> On 1/27/06, *Bob Gailer* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Bob Gailer wrote:
> > Alan Gauld wrote:
> >
> >> Hi Ben,
> >>
> >>
> >>
>
Jon Moore wrote:
> Hi,
>
> I am still working my way through my 'Python for absolute beginners
> book' and have hit a brick wall with one of the end of chapter exercises.
>
> The challenge says:
>
> Improve the function ask_number() so that the function can be called
> with a step value. Make the
John Joseph wrote:
> Hi
> I am trying to execute .py scripts from my
> apache web server , but it is not giving the results
> as how I run php files , it just displays the
> contents of the script , I am able to run and get
> results of PHP from the same loaction
> my “sample-test.py “file
Further delving leads to "Apache Tutorial: Dynamic Content with CGI" in
the Apache Documentation.
Under that is a section "But it's still not working! ... you see ... The
source code of your CGI program ...That means that you have not properly
configured Apache to process your CGI program. Rere
Jon Moore wrote:
> Hi,
>
> Ok its the last exercise in the chapter of the python book (Python for
> the absolute beginner) I am working my way through.
>
> I have been learning about functions using a tic-tac-toe game as an
> example and I understand it fairly clearly, however the author says
>
Kermit Rose wrote:
> Sqrt is listed as always available.
>
Where did you see that?
Try:
>>> import math
>>> math.sqrt(24)
4.8989794855663558
> Why did I get these diagnostics?
>
>
>
Sqrt(J0)
>
> Traceback (most recent call last):
> File "", line 1, in -toplevel-
>
John Purser wrote:
> 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?
>
I don't know whether i
János Juhász wrote:
> Hi All,
>
> I would like to make a small RDT Server as COM Server in python that can be
> called from excel as =RDT("StockBalance.MyServer",,"17")
>
I for one have no idea what RDT is, so can't help. Maybe someone else
has an idea. Or can you give us more information o
铁石 wrote:
> I know this may seem to be stupid.
> but as I found that there's no
> switch-case control flow in python,
> an I just can't remember( or know) any
> method to make such a control flow.
>
if cond1:
stmts
elif cond2:
stmts
...
else:
stmts
No need for break.
>
>
> --
Ben Vinger wrote:
> Thanks to all who responded. I ended up using a sender parameter as
> suggested by Andre and Alan, as this was very simple to do.
When confronted with problems like this I tend to create classes, then
subclass as needed for special circumstances. You might consider that
app
ryan luna wrote:
> My question seems like itd be farly simple but i cant
> seem to get it to work,
> My .dat file is a dictionary and i need to be able to
> only delete a single word and its definition,
> heres what i have so far but it doesn't work.
>
AARHG! I am always frustrated by "it doesn'
kevin parks wrote:
> i have a module called foo.py
>
> foo.py imports random
>
> kp.py imports foo.py ... but in kp.py i also need to use stuff from
> random...
>
> so kp.py also imports random
>
> but i prolly shouldn't do that right?
>
Wrong.
> Cause now, haven't i needlessly copied the s
Edgar Antonio Rodriguez Velazco wrote:
> Hi,
> Could you please explain this code?.
>
> f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
You've had 2 replies that dissect the "expression". I fear they might
not make lambda itself clear, so I will add my explanation.
lambda is a Python operator that
kevin parks wrote:
> i have various functions (that i didn't write) that put out data in
> lists of various types. But some functions (which i didn't write) that
> expect the data to be scaled, sometimes 0-1 sometimes 1-2, sometimes
> 0-127..., sometimes 0 - 32768... gosh you name it. In other w
Srinivas Iyyer wrote:
> Dear group,
>
> ***Disclaimer***Not suitable for BioPython list***
>
> I work with GeneChips to analyze human gene expression
> patterns. These genechips are various kinds one of the
> variety is made at Stanford University. In a typical
> experiment, an experimenter uses r
Hugo González Monteverde wrote:
> Alan Gauld wrote:
>
>
>> Which language(s) do you know that has such a feature?
>> And why do you consider it so useful that you expect to find
>> it in Python?
>>
>
> I'm not the original poster, but being a perlhead before, I can say it
> exists in Perl.
Dana Robinson wrote:
> Hello,
>
> Suppose you have a situation where you have a large number of command-line
> options that you will parse with getopt. You want to keep track of these
> as you move around in the code and do various things.
>
> Is it more Pythonic to:
>
> Have the functions take la
Jesse wrote:
> Why is it that when one variable is assigned a value in terms of
> another variable, assigning a new value to the first doesn't change
> the value of the second? This is giving me a huge headache, since I
> have a bunch of variables defined in terms of one another, and I want
> t
I will be out of the office starting 03/31/2006 and will not return until 04/10/2006.
I will respond to your message when I return.___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Payal Rathod wrote:
> On Mon, Apr 10, 2006 at 10:05:45AM -0400, Kent Johnson wrote:
>
>> You might like to look at "Python Programming for the absolute
>> beginner". It is oriented to beginners and has many examples and
>> exercises.
>>
>
> I might not be able to afford another book, due
Keo Sophon wrote:
> Hi,
>
> With raw_input(), it allows to input value. Can it be used to input value
> with default value option?
>
response = raw_input("Enter some data:")
if not response: response = "default value"
___
Tutor maillist - Tutor@pyt
Alan Gauld wrote:
>> Syntactic sugar *IS* a practical benefit. After all, every language above
>> assember is syntactic sugar, and by your definition of no practical use.
>>
>
> Ah, but by that standard even assembler is syntactic sugar, now
> where are those hex codes and my keypunch? :-)
Onl
Andrew D. Fant wrote:
> [snip] try crossing lisp
> with APL for a mathematically pure language that nobody can ever read.
>
One problem is that APL allowed unbalanced parentheses (as in )SAVE),
whereas LISP does not. And of course there is the right-to-left vs
left-to-right issue...
I do mis
Jesse wrote:
> Hey, this should be an easy question for you guys. I'm writing my
> first program (which Bob, Alan, and Danny have already helped me
> with--thanks, guys!), and I'm trying to create a simple command-line
> interface. I have a good portion of the pro
John Corry wrote:
> Liam,
>
> Thanks for the quick response. I have changed the code so that dsn is now
> DSN. However I get the same error.
I agree with Alan.the dsn should point to a data source rather than a file.
To be more precise
Start -> Settings -> Control Panel -> Administrative Tools
Paul D. Kraus wrote:
> I have a list that I want to change in a for loop. It changes in the
> loop but the changes are not persistant outside of the loop.
> I thought lists were mutuable objects
They are.
> so I am a bit confused.
>
> Sample Code
> #!/usr/bin/env python
> """ Testing lists ""
John CORRY wrote:
>
> Hi,
>
>
>
> Thanks for all the help so far on my database questions. I have now
> developed a program that reads in info from a csv file and updates
> already existing records in my database. I have enclosed the code
> below. The good news is that it is working. Howev
Andre Engels wrote:
> Is it possible to define a class in such a way, that if twice an
> object is made with the same initialization parameters, the same
> object is returned in both cases?
>
Use a "factory" function, and store a dictionary of instances as a class
property:
class myObj(object)
Bob Gailer wrote:
Andre Engels wrote:
Is it possible to define a class in such a way, that if twice an
object is made with the same initialization parameters, the same
object is returned in both cases?
Use a "factory" function, and store a dictionary of inst
Andre Roberge wrote:
> On 4/25/06, Hugo González Monteverde <[EMAIL PROTECTED]> wrote:
>
>> Remember duck typing. An object just needs to look like a file in order
>> to be used like one.
>>
>> Guido's time machine has already forseen your problem. Take a look at
>> the StringIO module. It allo
Jon Whitehouse wrote:
> Greetings All,
>
> I'm a newbie to python and am curious if I can do the following in python. I'm
> not asking HOW to do this, just if it is possible before I spend the time to
> learn python and do it myself.
>
> I want to write a program to go to a webpage, pull the data,
Matthew Webber wrote:
> I have a list that looks a bit like this -
>
> [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299),
> (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3),
> (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)]
>
> The list items are tuples
[EMAIL PROTECTED] wrote:
> ok checking out crossword program how do i run this program
Sorry but that is not enough information for us to act on.
What "crossword program"?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tu
Alan Gauld wrote:
> The mistakes in my databae topic have now been rectified.
> I have no idea how I managed to post the file without testing
> that section of code. And unfortunately it's one of the areas
> where SqlLite SQL syntax varies from the Oracle syntax that
> I'm most familiar with. Bu
emory to one of its IBM Mainframes runnuig VM, at a cost
over $100,000!
At least that reduced the spooling of virtual memory to the card
punch/reader. ;-)
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
,%m,%d") to get yy,mm,dd.
Or you can, as the ActivePython docs suggest, use int(curr_date) to get
an integer value which you can then float.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Because there are several things
that will lead to "compile errors" and "execution errors". I hope you
run it and think about the errors, then if stumped ask us.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Chris Delgado wrote:
> Bob et al,
>
> Ok guys, program is all fixed up and runs well. HEre is the final
> code. Thanks for the help and its on to the next prog. Thanks for the
> patience and help!
>
> Chris
>
> # A program that simulates flipping a coin 100 times an
hon.
The hardest part was wading thru Oracle tech support, and dealing with
error messages such as "invalid type or number of parameters" in a call
that involved many parameters. :'(
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
or any other variable. When defining a method in a class
one writes def abc(self, a,b,c) OR def abc(this, a,b,c). Then one refers
to "self" or "this" within the method to refer to the instance calling
the method.
--
Bob Gailer
510-978-4454
Broadband Phone Service for local
like.
Just say the magic word PLUGH! Be sure to pick up the batteries while
you're in there.
How about re?
import re
Build the search pattern:
pattern = "|".join(junkList)
Compile it:
junkListPattern = re.compile(pattern)
def removeJunk(reply, junkListPattern):
return
5))
On my computer I get the desired result. I paste it here 80°F = 27°C
and I see degree symbols.
What operating system / terminal hardware are you using?
--
Bob Gailer
510-978-4454
Broadband Phone Service for local and long distance $19.95/mo plus 1 mo Free
ation class.
--
Bob Gailer
510-978-4454
Broadband Phone Service for local and long distance $19.95/mo plus 1 mo Free
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ogrammers to use upper case names to represent
constants, e.g. RED = 3.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
nstances of the same thing it is a lot easier for me to track the
individual data values in class instances rather than in some sequence
or mapping (the alternative if one does not use classes).
Welcome to the adventure. You are standing
--
Bob Gailer
510-978-4454
Broadband P
Christopher Spears wrote:
I'm a bit embarassed to ask this...I am looking at a
tutorial for PyGTK+ that is discussing widgets. What
are widgets?
http://en.wikipedia.org/wiki/Widget_(computing)
--
Bob Gailer
510-978-4454
Broadband Phone Service for local and long distance $19.
r used hex a lot.
I just looked at my copy of PyExcelerator. It seems to be in poor shape.
I tried running some of the modules that have if __name__ == '__main__':
(i.e. self-testing) and they failed with errors! And I find no visible
documentation or working examples. Sigh.
The only
Bob Gailer wrote:
Paul D. Kraus wrote:
Are their docs anywhere for pyexcelerator? the built in docs are a bit
lacking.
For instance I can't figure out how to set a column width.
I am just reading the examples and they kind of help but I don't
follow this ...
ws.co
ange(b):
> for kk in range(d):
> fileHandle.write('%f %f %f %f\n' % (x_r[ii], y_r[jj], z_r[kk],
> p_field[ii][jj][kk]))
> fileHandle.close()
>
>
>
> """
> contour of surface velocity
> """
>
> fileHandle = file('mode shape.dat', "w")
> fileHandle.write('TITLE = "HW 4"\n')
> fileHandle.write('VARIABLES = "x"\n"y"\n"velocity"\n')
> fileHandle.write('ZONE T="%s"\n' % 'velocity field')
> fileHandle.write('I=%d, J=1, ZONETYPE=Ordered\n' % (num_y*num_x))
> fileHandle.write('DATAPACKING=POINT DT=(DOUBLE DOUBLE DOUBLE)\n')
> for ii in range(num_x):
> for jj in range(num_y):
> fileHandle.write('%f %f %f\n' % (x_coord[ii], y_coord[jj],
> V_mn[ii][jj]))
> fileHandle.close()
>
>
>
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
m.seed(time) sets the seed to the same value each time. (You are
passing a module object, whose ID becomes the seed). Try
random.seed(time.time()). Also you can set the seed once, then let each
call to uniform get the next "random" number.
Also consider:
development tools that include debuggers.
http://www.digitalpeers.com/pythondebugger/
http://pydev.sourceforge.net/
http://www.die-offenbachs.de/detlev/eric3.html
If you are running under Windows there is also
http://sourceforge.net/projects/pywin32/.
--
Bob Gailer
510-978-4454
e welcome.
>
> Cheers
> Kieran
>
>
> --
> "Behind every great man, there is a great woman. Behind that woman is
> Mr.T."
>
>
> ___
print out of this loop.
> But this will not work. Where is the error?
>
"Will not work" does not (in general) give us enough to go on. Please in
the future tell us what the evidence of the problem is - e.g. unexpected
output, exception, ... If it is an exception please i
Ivan Low wrote:
> Bob Gailer wrote:
>
>> Ivan Low wrote:
>>
>>> Hi, I'm new to python trying to figure how to make this work.
>>>
>>> c=0;d=raw_input("input number limit: ")
>>>
>>> while 1:
>>> c =
oice == 4:
> lookup()
> elif menu_choice == 5:
> deposit()
> elif menu_choice == 6:
> withdraw()
> elif menu_choice == 9:
> break
> else:
> print "That's not an option. Please choose a valid option."
> save_file(accountlist)
> print "Have a nice day!"
> Here is the error I'm having troubles solving:
> Traceback (most recent call last):
> File "C:\Python24\Account Tracker.py", line 87, in -toplevel-
> add()
> File "C:\Python24\Account Tracker.py", line 36, in add
> accountlist[account] = amount
> TypeError: list indices must be integers
>
> So. how do I solve it to make it work the way I want it to?
>
> Thanks,
> Nathan Pinno
>
>
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
o look for the keywords of interest in the page text and store them
with references to the links to the pages containing them. Python
dictionaries are the way to collect this data and the shelve module
provides a way to save Python objects such as dictionaries for later
retrieval.
Hope this helps g
ition of search engine was too
narrow. I did a Google search on python search engine and came up with
interesting links. I recommend you do this search too.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
hod do here?
>
When the function definition is processed, Python creates an empty list,
which will be used as the default value for q whenever the function is
called with no 2nd parameter. Any changes to that list are visible in
any call to the function that has no 2nd parameter.
To get th
u_choice = int(raw_input("Which item? "))
> if menu_choice == 1:
> add()
> elif menu_choice == 2:
> remove()
> elif menu_choice == 3:
> printall()
> elif menu_choice == 4:
> lookup()
> elif menu_choice == 5:
> deposit()
> elif menu_choice == 6:
> withdraw()
> elif menu_choice == 9:
> break
> else:
> print "That's not an option. Please choose a valid option."
> save_file(accountlist)
> print "Have a nice day!"
>
> Thanks for the help so far!
> Nathan Pinno
>
>
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Bob Gailer wrote:
> Nathan Pinno wrote:
>
>> Hey all,
>>
>> I am needing help on this. Why isn't it saving the data beore exiting
>> the program?
>>
> But it does save it. What evidence do you have that it is not?
>
> Please in the futur
countlist is still {}. Can you figure out why?
Hint: load_file(accountlist) does not change accountlist.
>
> Nathan Pinno
> - Original Message - From: "Bob Gailer" <[EMAIL PROTECTED]>
> To: "Bob Gailer" <[EMAIL PROTECTED]>
> Cc: "Nat
'
if os.path.exists(filename):
store = open(filename, 'r')
ac = pickle.load(store)
store.close()
else:
ac = {}
return ac
And change load_file(accountlist) to:
accountlist = load_file()
[snip]
--
Bob Gailer
510-978-4454
__
gt;
> What is going on? Why aren't the values of my variables changing when
> I change them inside a loop like this?
>
The program is not changing a or b or c in the loop. The for statement
assigns a to i. The next statement assigns a new value to i. a is not
affected. Change print i
my variables changing when
> I change them inside a loop like this?
>
> -- Evan
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
s used by the first file". I will assume you are
importing it. Import runs the imported module once. Subsequent
executions of import do NOT rerun the module. Therefore any changes you
make to it are not showing up. To work around this "problem", after
importing, use the reloa
> Now the exercise is:
> As an exercise, rewrite this function so that it
> doesn't contain any loops.
>
> I have been staring at this function and drawing a
> blank. Something tells me that I need to use
> iteration, but I am not sure how I could implement it.
>
take a look at the divmod built-in function.
>
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
> The second which is off topic is human nature and really is off topic.
> If you are interested in this, email me directly. Thanks!
Please include me on this discussion if you have it. I'm very interested
in this aspect, and may have something to contribute.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
anil maran wrote:
> i m trying to do email anonymizing like cl in a webapp can you suggest
> how to do it
I can't, but then I don't understand the terms you're using.
And how does this relate to Python?
--
Bob Gailer
510-978-4454
_
tly and retrieve mappings of real
to anonymous addresses?
7) anything else you can tell us so we can give specific help.
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Bob Gailer
51
print dict[c],
Also since dict and list are built-in functions it is not a good idea to
reassign these names.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ments is strictly prohibited. The company
> accepts no liability for any damage caused by any virus transmitted by
> this email. Furthermore, the company does not warrant a proper and
> complete transmission of this information, nor does it accept
> liability for a
ext + "\n")
> output.flush()
> output.write ("\n")
>
> I need to remove the extra characters so the file and email output
> isn't difficult to read. I also need to be able to use the dictionary
> data so that I can compose the message used by the smtplib.
>
>
> Any suggestions?
I for one have no suggestions to offer because I don't know what you
want. "suggestions on how to work with a dictionary" is not adequate.
Where are you stuck? Do you want critique of the code you posted, or how
use smtplib or what?
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Have you had the experience of finding a nifty bit of code on the
web, trying it out, and then discovering that technique
only worked in version X.YY, or requires module Z that
is no longer available?
Well perhaps we can address this situation.
I would like to see an online system that facilitat
onaries, sets and frozensets). All other values are interpreted as
true."
The 2 flow control statements that use expressions in this way are if
and while. Boolean operations are or, and, not.
So in "if [1]: print 1" [1] will be interpreted as True. However in
"[1] ==
I would like something that is easy,
> standard, and multi-platform. I am considering Tkinter and Jython. Any
> opnions on this?
>
Jython is not a GUI.
> Thanks for any answers you might have.
>
Thanks for asking. And good luck with the class. And just for grins see
http://www.fortran.com/come_from.html for FORTRAN's COME FROM statement.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
it will be very sparse
Just a guess but I think the lack of response is due to (at least for
me) not knowing enough about your situation to give a useful response.
Please tell us more.
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@pyt
A while back you attached factor34.py. Is that the program you are
having trouble with?
And you said it misbehaves "consistently with certain numbers to be
factored."
What are these numbers?
--
Bob Gailer
510-978-4454
___
Tutor maillist
h], media[c], outcome[winner[h][c]]) for h in
range(3) for c in range(3)]:
print '%10s%10s%10s' % r
else:
c = random.randint(0,2)
print '%10s%10s%10s' % (media[h], media[c], outcome[winner[h][c]])
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
601 - 700 of 2074 matches
Mail list logo