Re: [Tutor] Encoding

2010-03-03 Thread python
_cryptic_ (!), word "encoding". When editing an image using a software tool, there is a live representation of the image in memory (say, a plain pixel 2D array), which is probably what the developper found most practicle for image processing. [text processing in python: unicode string t

Re: [Tutor] Bowing out

2010-03-03 Thread python
Hi Kent, Your posts and web pages really helped me during my early days with python. Wishing you great success in your new endeavors!!! Cheers, Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

Re: [Tutor] Encoding

2010-03-07 Thread python
ding, I'm puzzled why anyone would use the regular open() for anything but binary operations. Malcolm - Original message - From: "spir" To: "Python tutor" Date: Sun, 7 Mar 2010 14:29:11 +0100 Subject: Re: [Tutor] Encoding On Sun, 7 Mar 2010 13:23:12 +0100 Gi

Re: [Tutor] Iterating through a list of strings

2010-05-03 Thread python
> Agreed that > > line = line[:line.index('%')] > > is slightly more readable than > >line = line.split('%', 1)[0] How about: line = line.partition('%')[0] partition() works even if '%' isn't present. The index() and split() techniques raise exceptions if '%' isn't present. Malcolm __

Re: [Tutor] portability of pickle and shelve across platforms and different python versions?

2010-05-06 Thread python
Garry, I asked a similar question on Stackoverflow.com and got some great responses including at least one from a member of the Python development team. Best way to save complex Python data structures across program sessions (pickle, json, xml, database, other) http://stackoverflow.com/questions

Re: [Tutor] a class query

2010-06-07 Thread python
Not the OP, but I was surprised to see class Name() work (in Python 2.6.5 at least). Is this equivalent to class Name( object ) or does this create an old style class? Going forward into the 2.7/3.x world, is there a preferred style? Thanks, Malcolm

Re: [Tutor] a class query

2010-06-07 Thread python
Hi Mark, >> I was surprised to see class Name() work (in Python 2.6.5 at least). Is this >> equivalent to class Name( object ) or does this create an old style class? >> Going forward into the 2.7/3.x world, is there a preferred style? > RTFM? :) I am reading TFM :) He

Re: [Tutor] a class query

2010-06-07 Thread python
> In Python 2.x, all classes are old-style unless you directly or indirectly > inherit from object. If you inherit from nothing, it is an old-style class > regardless of whether you say class Name: pass or class Name(): pass. In > Python 3.x, there are no old-style classes. T

Re: [Tutor] a class query

2010-06-07 Thread python
Steven, Thanks again for your explanations. I thought I had missed a major change in Python class behavior - relieved to find that I'm up-to-date. Cheers, Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription op

Re: [Tutor] a class query

2010-06-07 Thread python
Hi Mark, > I see that Stephen D'Aprano has already replied twice so I won't bother. > Apart from that no offence meant, I hope none taken. Your RTFM reply actually gave me a good laugh. No (zero) offence taken. And I appreciate your many helpful posts in these forums. Cheers, Malcolm __

[Tutor] Confirm that Python 2.6 ftplib does not support Unicode file names? Alternatives?

2010-06-23 Thread python
Can someone confirm that Python 2.6 ftplib does *NOT* support Unicode file names? Or must Unicode file names be specially encoded in order to be used with the ftplib module? The following email exchange seems to support my conclusion that the ftplib module only supports ASCII file names. Should

Re: [Tutor] Confirm that Python 2.6 ftplib does not support Unicode file names? Alternatives?

2010-06-26 Thread python
Updating this thread for users searching the archives. Additional commentary can be found in this thread I started on Stackoverflow.com. http://stackoverflow.com/questions/3120295/confirm-that-python-2-6-ftplib-does-not-support-unicode-file-names-alternatives Gabriel Genellina added the

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread python
Mac, > My answer falls in the category "feedback" ... I'm not the OP, but I wanted to let you know that I really enjoyed your feedback - excellent writeup! Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

Re: [Tutor] web-based python?

2010-08-01 Thread python
Alex, > I have an IPowerWeb.com server, which claims to support Python Many hosting providers claim to support Python. The best hosting service I've found for Python is webfaction.com. Originally this hosting provider specialized in just Python hosting and this enthusiasm for Python and

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread python
Richard, Look at the os.path.isfile function. Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem with python

2010-10-24 Thread python
> I just wanted to note that Steven is a great teacher! +1 Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Too different 2.6 vs 2.7?

2010-11-08 Thread python
Jorge, Python 2.7 supports an updated version of the Tkinter GUI framework with support for native themes (ttk). This makes it possible to create professional looking user interfaces without having to install a separate GUI framework like wxPython or pyQt. Malcolm

Re: [Tutor] Simple counter to determine frequencies of words in a document

2010-11-21 Thread python
> it is difficult for me not to be profuse in my thanks because you guys really > go beyond the call of duty. I love this list. The responses in this list most > of the times don't just address the problem at hand but are also useful in a > more general sense and help people become better progra

Re: [Tutor] Simple PassGen

2009-02-10 Thread python
Kent, > Except they are not equivalent when you want to print more than one thing. > ... > Python 2.6: > In [1]: print(3, 4) > (3, 4) I'm running Python 2.6.1 (32-bit) on Windows XP. I don't get the tuple-like output that you get. Here's what I get:

Re: [Tutor] Simple PassGen

2009-02-10 Thread python
Lie, >> Here's what I get: >> >> >>> print( 3, 4 ) >> 3 4 > Are you sure it isn't python 3.x you're playing with? The reason why simple > print function "works" in python 2.x is because of a syntactical coincidence, it is still

Re: [Tutor] Simple PassGen

2009-02-10 Thread python
DOH! I just realized why we're getting different results. Sorry for the confusion - I wasn't trying to be a smart-ass! We've been trying to future proof our new code for Python 3.x so we automatically have 3.0 print() functionality enabled in our Python 2.6 dev environ

Re: [Tutor] Simple PassGen

2009-02-11 Thread python
6:11 +1100 Subject: Re: [Tutor] Simple PassGen On Wed, Feb 11, 2009 at 2:26 AM, <[1]pyt...@bdurham.com> wrote: > Are you sure it isn't python 3.x you're playing with? The reason why simple print function "works" in python 2.x is because of a syntactical coinciden

[Tutor] Possible to change values of scalar function parameters?

2009-02-17 Thread python
Is there a way to change values of scalar function parameters? I know you can change the values of parameters if the parameter is a mutable type like a list, but is there a way to update the value of scalar parameters of type integer or string? Simple example: Is there a way to have the following f

Re: [Tutor] Possible to change values of scalar function parameters?

2009-02-17 Thread python
Kent, > No, not a simple way at least. Possibly you can do it with hackery involving stack frames but I wouldn't recommend that. Either pass the values in some kind of container (list, dict, class instance) or return the new value and assign it in the caller. That's what I thought. Thank you! Ma

Re: [Tutor] Possible to change values of scalar function parameters?

2009-02-17 Thread python
Alan, > But don't forget that in python you can return multiple values from a > function. Yes. Thank you! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Yet another Python book

2009-04-11 Thread python
Dave, Great stuff!!! Thanks for sharing your hard work with the community! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] importance of Docstring

2009-04-16 Thread python
Albert, That was a great writeup on docstrings. I'm going to share that with my dev team. Thank you! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Pythonic way to normalize vertical whitespace

2009-05-08 Thread python
Note: Following cross-posted to python-list where it got queued due to suspicious subject line. I'm looking for suggestions on technique (not necessarily code) about the most pythonic way to normalize vertical whitespace in blocks of text so that there is never more than 1 blank line be

Re: [Tutor] clean text

2009-05-19 Thread python
Denis, Untested idea: 1. Fill a dict with pre-calculated repr() values for chars you want to replace (replaceDict) 2. Create a set() of chars that you want to replace (replaceSet). 3. Replace if (n < 32) ... test with if char in replaceSet 4. Lookup the replacement via replaceDict[ char ] vs.

Re: [Tutor] clean text

2009-05-19 Thread python
Denis, Thank you for sharing your detailed analysis with the list. I'm glad on didn't bet money on the winner :) ... I'm just as surprised as you that the regex solution was the fastest. Malcolm ___ Tutor maillist - Tutor@python.org http://mail.pyt

Re: [Tutor] Best Python Editor

2009-06-13 Thread python
Alan, > I spoke a wee bit too soon. The editor is nice but the debugger and some of > the other tools windows (eg variables) are broken. Pity, lots of potential > here. The current release of Pyscripter is not stable. Drop back one release and you'll find a very solid product. Malcolm ___

Re: [Tutor] Best Python Editor

2009-06-13 Thread python
>> The current release of Pyscripter is not stable. Drop back one release and >> you'll find a very solid product. > Sounds interesting. What is the stable version and where can it be found? Ken, Here's the version we use: Version 1.7.2, Oct 2006 http://mmm-experts.com/Downloads.aspx?ProductId

Re: [Tutor] mac os x executable

2009-07-07 Thread python
Alan, > After all with Python 2.3 pre installed on MacOS X Is Python 2.3 really the most recent version of Python distributed with new Macs? So if I wanted to distribute a Python 2.6 script to a Mac user, I would need to instruct the Mac user how to download and install a separate version

Re: [Tutor] Python Tutorials: How to create useful programs after learning the syntax?

2009-07-08 Thread python
> but if you ever come across a copy of "Core Python Programming," i've put > lots of exercises at the end of every chapter. +1 from a reader/customer (vs. the author) "Core Python Programming" is an excellent resource for learning Python. I enjoyed the exercises

Re: [Tutor] Python Tutorials: How to create useful programs after learning the syntax?

2009-07-09 Thread python
Wesley, You mean my check is not in the mail? Damn! Well, no more positive reviews for you :) Since you've stepped off your soapbox, I'll also mention your free hour long video hosted by Safari Books (you may have to signup for a free account to see the video). What is Python by

[Tutor] Basic terminology

2005-02-15 Thread python
Hi, I'm reading a Python book right now (Learning Python, a great book!), and there are few terms that come are brought up a few times but without any explanation. So what are: - "remainders" (in the context of remainders-of-division modulus for numbers) - "modulus" (in

[Tutor] MySQL Connection Function

2005-06-21 Thread Python
Here's my sample code. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #! /usr/bin/python # sqlconnect.py import MySQLdb as SQLdb db_parms = { 'regular': { 'host': 'localhost', &

[Tutor] First Project - Ping Sweeper!

2005-07-12 Thread Python
sed in UDP and TCP. The port scanning program will not help you with ping. UDP and TCP have port numbers because they are application-to-application protocols and use the port number to identify the target application. I checked the index of "Foundations of Python Network Programming&q

[Tutor] Closing BaseHTTPServer...

2005-07-16 Thread Python
, BaseHTTPServer.HTTPServer): pass srvr = ThreadingHTTPD( , ) srvr.serve_forever() Credit for this goes to John Goerzen and his fine book "Foundations of Python Network Programming" -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@pytho

[Tutor] sys.argv?

2007-04-17 Thread python
I've been reading the python tutorial trying to get used to the style tryna understand it. So I come across this: "sys.argv[0]" in the tutorial on python.org. What is "sys.argv"? How does it work? Can someone give me a simple

[Tutor] range() help

2007-04-17 Thread python
Alright I'm a bit confused when looking at how range works. I'm reading lesson 4.3 in the python tutorial. http://docs.python.org/tut/node6.html I came across this: >>> range(-10, -100, -30) [-10, -40, -70] How come it prints on -40 or -70. Does -70 come from -70 ->

[Tutor] Python Browser based?

2007-04-17 Thread python
How can I used python online. I'm getting my hoster to install python and I'm wondering how Do I use python online? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] celcius to farenheit converter.

2007-04-17 Thread python
I found this site and I'm practicing coding and I write this script, but I'm unsure why its not working. Everything goes well until it gets to the part where it tries to calculate the formula. Inputs work fine anyone know what I did wrong? ### #Temperature Convert

[Tutor] Python 2.4 or Python 2.5?

2007-04-20 Thread python
Im confused When i had python 2.4 all my scripts work correctly should i reinstall python 2.4? Or should I keep 2.5? Where can I find information on coding for python 2.5? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo

[Tutor] Counting help

2005-08-23 Thread Python
ert(0, nameofsender[0]) If you are using a version of Python that supports sets, using sets would be much simpler since the duplicates get discarded automatically. import sets # python2.3 setofnames = sets.Set() while. setofnames.add(nameofsender[0]) len(setofnames) #

[Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Python
. The %s in the VALUES serves as a placeholder for the module and should not be used by you with the Python string format (%) operator. This should work so long as the name and URL never contain commas. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] MySQLdb error - PLEASE SAVE ME

2005-09-17 Thread Python
> I dont see why your new code shouldn't work, it makes sense to me ... Danny nailed this one. He warned that your data could be short commas. You have lines with fewer than two commas. The INSERT is failing with: not enough arguments Simple fix is to skip insert if len(links) != 3. No

[Tutor] subclass problem: __names and type-checking

2005-10-08 Thread Python
I think that a sub-class *needs* to support the same programming interface as the parent class. Bertrand Meyer has written about programming by contract and the implications for object oriented design. http://archive.eiffel.com/doc/oosc/ http://se.ethz.ch/~meyer/ If B inherits from A then every c

[Tutor] subclass problem: __names and type-checking

2005-10-08 Thread Python
Traceback (most recent call last): File "C:/Python24/foofoofoo.py", line 26, in -toplevel- s2 = Sub2() File "C:/Python24/foofoofoo.py", line 22, in __init__ super(Sub2, self).__init__() File "C:/Python24/foofoofoo.py", line 10, in __init__ if type(self) == __TwoUnderBase: #

[Tutor] Listing all of an instances variables

2005-10-08 Thread Python
def report(self): for i in dir(self): # use the getattr function print getattr(self, i) -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Using CGIHTTPServer on Windows to run Perl & Python scripts - POST to Perl fails

2005-11-11 Thread Python
The perl scripts use cgi.pm. The Python scripts use the cgi module. Everything runs OK on Linux, where fork is available. On Windows the run_cgi method uses os.popen3 to run the script and writes the post data to the script's input file. The Python scripts are OK. The Perl scripts d

[Tutor] Using CGIHTTPServer on Windows to run Perl & Python scripts - POST to Perl fails

2005-11-12 Thread Python
ut ) { print $key, ' = ', $input{$key}, "\n"; } #print a couple of simple forms: a POST form and a GET form print qq{ }; print qq{ }; print qq{}; <<<<<<<<<<<<<<<<<<<&

Re: [Tutor] question about serial coms

2005-11-15 Thread Python
The device at the far end of the serial connection is echoing what you write back to you. This is a convenience for someone typing at a terminal, but a nuisance when you are programming. The easier way out is to turn echoing off at the far device. Failing that, you will want to provide a copy of

[Tutor] [Fwd: Re: question about serial coms]

2005-11-15 Thread Python
to reality... It's the simple stuff that will get ya! :) -Joe --- Python <[EMAIL PROTECTED]> wrote: > The device at the far end of the serial connection > is echoing what you > write back to you. This is a convenience for > someone typing at a > terminal, but a nuisanc

Re: [Tutor] question about ord

2005-11-15 Thread Python
chr(value) >>> chr(ord('a')) == 'a' True On Tue, 2005-11-15 at 14:46 -0600, nephish wrote: > Hey there, > i am using a script to change a byte into an integer > like this: > a = the byte > value = ord(a) > > but i cant find the operation that can change it back to a byte. > i am

Re: [Tutor] Dynamic inheritance?

2005-11-19 Thread Python
On Sat, 2005-11-19 at 16:45 +0100, Jan Eden wrote: > > Is there a way to dynamically determine the value of Super at runtime? > Background: Depending on certain object attributes which are set during the > object initialization, I need to use a different set of templates for the > respective ob

Re: [Tutor] Dynamic inheritance?

2005-11-19 Thread Python
On Sat, 2005-11-19 at 15:23 -0800, Danny Yoo wrote: > Here's a small example that shows how classes can be treated just like any > other value in Python: > > # > def makeYa(superclass): > class Ya(superclass): &

Re: [Tutor] smtplib alternative???

2005-11-20 Thread Python
nt domains hosted by 3 different mail servers? Smtlib prohibits > this functionality. Do you see what I mean now...? > > Thanks for replying... If you have a conventional email program (e.g. Thunderbird, Evolution, Outlook Express) then the smtp server listed in that config should work

Re: [Tutor] smtplib problems ?

2005-11-21 Thread Python
On Mon, 2005-11-21 at 19:59 +, dave wrote: > Traceback (most recent call last): > File "/home/dave/my files/andrew_torture/email_remind.py", line 49, in ? > email_remind() > File "/home/dave/my files/andrew_torture/email_remind.py", line 43, in > email_remind > raise 'Mail Failure

Re: [Tutor] lowercase, uppercase

2005-12-10 Thread Python
IS SOME MIXED CASE TEXT' Unless you are using a very old version of Python, there is no need to use the string module. the upper and lower methods now built into str and unicode objects. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Multi-Dimensional Dictionary that contains a 12 element list.

2005-12-31 Thread Python
On Sat, 2005-12-31 at 09:33 -0500, Kent Johnson wrote: > Could be >self.results[key] = [0*24] [0]*24 Excellent points and advice, just noting a typo. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://

Re: [Tutor] Design suggestion - is a cookie the answer?

2006-01-16 Thread Python
On Mon, 2006-01-16 at 01:12 +, Alan Gauld wrote: > > I'm sure this is implied in Alan's post, but I'm going to point it > out > ... > > To avoid further cheating you might want to sure there is no way to > > submit the form without javascript turned on. E.g. Don't have a > submit > > button and

Re: [Tutor] Open file error

2006-01-17 Thread Python
s: 'C:\\Test.txt' > > I know for sure that the file is there, I even put copies of the files > here and there, just to guess how python does the file search, but it > keeps giving me 'No such file or directory'. i also tried variation of > the file location

Re: [Tutor] Open file error

2006-01-17 Thread Python
pful when writing regular expression strings which often need to have backspace characters. Internally, a raw string is the same as any other Python string. When Python displays a raw string, Python will show the backslashes as \\ (doubled) because that is usually how you need to enter a backslash

Re: [Tutor] Quoting trouble

2006-01-20 Thread Python
'h_' + key[:-2].lower().replace('-','_'), val ) Now the line that actually determines the attribute name looks pretty ugly. I would recommend writing a function to replace that operation with an understandable function name (perhaps key2name). That would

Re: [Tutor] Is this overkill?

2006-01-21 Thread Python
On Sat, 2006-01-21 at 10:09 -0500, Bradly McConnell wrote: > On 1/21/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > > number = input("Please enter a number: ") > > while number != 100: > > additional_number = input("Please enter an additional number: ") > > if additional_number + number > 100:

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
On Sun, 2006-01-22 at 21:23 +0300, ZIYAD A. M. AL-BATLY wrote: > wrong_string = '''SELECT s FROM t WHERE id=%s''' , (email_id) The string is being used in a call to cursor.execute. The email_id is a second parameter getting passed to execute. That is the *correct* approach to use. That

Re: [Tutor] Linux Python install?

2006-01-23 Thread Python
On Mon, 2006-01-23 at 09:28 -0500, CPIM Ronin wrote: > Sorry to bother the list with so simple a question but on moving to Linux > from Windows XP, it's not clear to me how to accomplish a Python install on > Linux. On XP it was mostly point and click on a ".msi" file (

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
On Mon, 2006-01-23 at 18:17 +, Alan Gauld wrote: > > On Sun, 2006-01-22 at 21:23 +0300, ZIYAD A. M. AL-BATLY wrote: > >> wrong_string = '''SELECT s FROM t WHERE id=%s''' , (email_id) > > > > The string is being used in a call to cursor.execute. The email_id is a > > second parameter g

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
uot;", (s_email,)) The execute method will handle the string substitution. This is better than doing it yourself, because execute will deal with any quoting issues for feeding the data to the database. I should have included the original code as I did here. Sorry if I created any confu

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
t; > Ah I see. Yes that's a different proposition entirely! > I really should read the whole thread before jumping in... :-( > > Alan G. > Well I created the trap by not pasting in the execute call and posting what was on its face an invalid piece of Python coding. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] email-sending.. (fwd)

2006-01-30 Thread Python
On Sun, 2006-01-29 at 10:09 -0800, Danny Yoo wrote (forwarding a direct reply to the list): > Hi Danny, > > i have crossed that point where it complains of socket error.., but > now i am stuck with another issue, where it says that it has sent the > mail, but i dont recive any in my yahoo mail.,i

Re: [Tutor] smtplib with yahoo smtp server

2006-02-01 Thread Python
by 10.65.100.11 with HTTP; Wed, 1 Feb 2006 05:21:36 -0800 > (PST) > Message-ID: > <[EMAIL PROTECTED]> Intercodes, you are using a web interface to send your email. Can you get a "normal" (Evolution, Thunderbird, pine, etc.) email client to work on your system. If those d

Re: [Tutor] Postgresql+Python -tutorial?

2006-02-11 Thread Python
On Sat, 2006-02-11 at 16:19 +1000, Joal Heagney wrote: > > I'm curious. Why? > > Is there some advantage to Postgres over MySql? > > Yes and no. Postgresql offers more features and is IMO more flexible > than most SQL servers out there. A friend described MySQL as the RDBMS for people who do not

Re: [Tutor] problems with the shebang line and linux

2006-02-16 Thread Python
face to your package manager (yumex is the yum GUI, I do not remember the name of the apt GUI). On a shared partition, keeping .py files in a posix format (LF only) has never caused any problems for me. The Python compiler/interpreter on Windows will happily process either format

Re: [Tutor] Telnet to cisco device

2006-02-28 Thread Python
On Tue, 2006-02-28 at 16:36 +1000, STREET Gideon (SPARQ) wrote: > tn.read_until('Username: ') #expected prompt after telnetting to the > router > tn.write(user + '\r\n') #hopefully write username and pass character > return > Sending both \r and \n may be confusing things. I'd recommend using t

Re: [Tutor] URGENT doubt!!!!

2006-03-01 Thread Python
On Wed, 2006-03-01 at 17:13 +0100, Joaquin Sanchez Sanchez wrote: > I have a doubt > > I have some modules in python, and in one of them, i have to > dictionarys. In them, i have some vars yhat I want to save before > clossing my session, ande then, in a new session, i want to loa

Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-03 Thread Python
On Fri, 2006-03-03 at 15:41 +1000, STREET Gideon (SPARQ) wrote: > The problem I'm stumbling over is that when I print x, the output is > what I want. If I delete the print x and #, leaving only tn.write(x) > on > the last line everything looks good except it writes the 1st item in > "lines" (the b

Re: [Tutor] One shared object. class attribute or global variable?

2006-03-03 Thread Python
On Sat, 2006-03-04 at 00:42 +, Adam wrote: > On 04/03/06, Adam <[EMAIL PROTECTED]> wrote: > > I've got a module that needs to share a pack of cards > > > > pack = ["14s", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "10s", "11s", > > "12s", "13s", "14d", "2d", "3d", "4d", "5d", "6d", "7d

Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-06 Thread Python
On Tue, 2006-03-07 at 11:31 +1000, STREET Gideon (SPARQ) wrote: > Enter configuration commands, one per line. End with CNTL/Z. > switch01(config)#banner exec ^ > > ## > > switch01 > > Level XX, XX Some Street, Somewhe

Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-06 Thread Python
This kind of scripting is often done with expect and I believe that there is some expect-like module for Python. As I suggested earlier, getting tftp to send command files will make a much better long term solution. This script would only have to manage logging in and starting tftp. Once that w

Re: [Tutor] need help tracing a syntax error

2006-03-11 Thread Python
On Sat, 2006-03-11 at 10:42 -0500, Kermit Rose wrote: > I get the message > > syntax error > > > and it highlightsr2 > > in the line > > .If r2 == 1: if should be lower case (all of the python syntax words are lower case) You will also need to change Els

Re: [Tutor] Python & MP3

2006-03-21 Thread Python
On Tue, 2006-03-21 at 10:50 +0100, Johanna wrote: > Hallo > > > > This is my first post, so hallo to everyone. Im just a newbee with > python so I hope my msg will make some sense. J > > > > Is it possible to work with MP3 in python? yumex lists pyth

Re: [Tutor] Question about large numbers of arguments

2006-04-05 Thread Python
On Wed, 2006-04-05 at 12:34 +0100, Alan Gauld wrote: > > 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:

Re: [Tutor] date conversion

2006-04-05 Thread Python
On Wed, 2006-04-05 at 10:50 -0400, Kent Johnson wrote: > Ray Allen wrote: > > I would like Python to convert a date returned by MySQL (2006-04-05) Kent's advice below is of course correct, but I'd bet your variable is already a datetime.date (or mx.DateTime.Date with older Py

Re: [Tutor] failing to learn python

2006-04-11 Thread Python
On Tue, 2006-04-11 at 12:06 -0400, Payal Rathod wrote: > The reason I am disgrunted with Python is because lack of good > documentation. http://www.python.org/doc/ The Python Docs - possibly you missed this because of the plethora of links. The Library Reference used to have the ta

Re: [Tutor] checking diagonals on a chessboard

2006-04-13 Thread Python
diag #. Scratching your head over how to number the diagonals I'll leave to you. They counted 30 diagonals, so if you come up with a different count, you either have an original approach or have blundered somewhere. (Hopefully that was the kind of pointer you were looking for. Tim Pete

Re: [Tutor] encode

2006-04-18 Thread Python
On Wed, 2006-04-19 at 10:10 +0700, kakada wrote: > Hi again folks, > > I wonder if we can check the encoding of text in one text file. > user is free to encode the file whether Latin1, utf-8, ANSI... > Any ideas? def decode_file(filepath): '''Order of codecs is important. ASCII is most r

Re: [Tutor] Splitting a number into even- and odd- numbered digits

2006-04-20 Thread Python
On Wed, 2006-04-19 at 17:17 -0700, Carroll, Barry wrote: > Greetings: > > I am writing a function that accepts a string of decimal digits, > calculates a checksum and returns it as a single character string. > The first step in the calculation is to split the input into two > strings: the even-

Re: [Tutor] looking to hire a tutor

2006-04-22 Thread Python
On Fri, 2006-04-21 at 19:44 -0700, [EMAIL PROTECTED] wrote: > How would I go about hiring a python tutor who: > > Spends time critiquing my code and providing detailed feedback. > Cares about good programming practices and is able to provide cogent > explanations of programming pr

Re: [Tutor] counting number of inputs

2006-05-02 Thread Python
Do you know how to get input from the user? Do you know how to count things in Python? Do you know how to test a number to see if it is positive or negative? Why don't you post your code for any part of this problem and explain how it is supposed to work and where you are having difficulty.

Re: [Tutor] counting number of inputs

2006-05-03 Thread Python
is missing any logic to actually break if -1 is entered. With a language like BASIC, you could stick in tests sort of like: if number1 == -1 goto done: BUT Python does not have a goto. So we actually need some "flow control" around the block of code where you collect inputs. w

Re: [Tutor] counting number of inputs (EARLIER VERSION SENT ACCIDENTLY)

2006-05-03 Thread Python
is missing any logic to actually break if -1 is entered. With a language like BASIC, you could stick in tests sort of like: if number1 == -1 goto done: BUT Python does not have a goto. So we actually need some "flow control" around the block of code where you collect inputs. w

Re: [Tutor] Bitten by lexical closures

2006-05-03 Thread Python
On Wed, 2006-05-03 at 14:00 +0200, Igor wrote: > Hi. > > And I thought I understood python pretty well. Until I got hit by this: > > >>> def f(x): > ... print x > > >>> cb = [lambda :f(what) for what in "1234"] > >>> for c in cb

Re: [Tutor] counting number of inputs (EARLIER VERSION SENT ACCIDENTLY)

2006-05-03 Thread Python
ill end the for block. Now, one of the cute features in Python is the else clause that goes with the for and while blocks. The else block is executed when there is no break. So the skeleton for your program can look something like for x in range(5): # get inputs and break on -1 else

Re: [Tutor] web intefaces?

2006-05-09 Thread Python
e, basically > > http://www.cherrypy.org > Which is an app server that should be fairly easy to package up with, > say py2exe. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442481 This is an example of configuring a cherrypy application so that it runs and starts the browser.

Re: [Tutor] Sending e-mail msg

2006-05-17 Thread Python
t; > server = smtplib.SMTP('mail.hennepinPublicHealth.org') > server.set_debuglevel(1) > server.sendmail(fromaddr, toaddrs, msg) > server.quit() > *** > > The output I get is: > > Message = From: [EMAIL PROTECTED] > > To: [EMAIL PROTECTED] >

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Python
On Mon, 2006-05-22 at 14:28 -0400, Andrew Robert wrote: > When I try to use the class listed below, I get the statement that > self > is not defined. > > test=TriggerMessage(data) > var = test.decode(self.qname) Perhaps var = test.decode() would do

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Python
could be moved to the top of the script and imported once Hopefully this helps. > > What I need is to get those values out. > > How to do that, I am not exactly clear. > > > Andy > > > Python wrote: > > On Mon, 2006-05-22 at 14:28 -0400, And

Re: [Tutor] cisco router + telnetlib

2006-05-24 Thread Python
On Wed, 2006-05-24 at 18:18 -0400, Daniel McQuay wrote: > Hello List, > > I am rather new to programming and I was wondering y'all think the > best way to configure a cisco router using python would be. currently > I am using telnetlib. my problem is, I get an error after

  1   2   3   >