Re: [Tutor] download google contacts

2017-12-06 Thread Jerry Hill
On Tue, Dec 5, 2017 at 10:10 AM, Atux Atux wrote: > i am looking for a way to download only the contacts from my google account > and export them in my linux machine in a txt file, every12 hours with > cronjob and overwrite the old txt file. > ​Have you read Google's Contacts API​ documentation?

Re: [Tutor] Tutor Digest, Vol 160, Issue 26

2017-06-23 Thread Jerry Hill
On Fri, Jun 23, 2017 at 4:18 PM, Jerry Hill wrote: > Try this instead: > > result > ​​ > = search_criteria + "/" + outputs > resultUrl = > ​​urljoin(baseUrl, result) > > > That should get you what you're looking for. > > Sorry, ​I should have

Re: [Tutor] Tutor Digest, Vol 160, Issue 26

2017-06-23 Thread Jerry Hill
On Tue, Jun 20, 2017 at 4:34 AM, angela ebirim wrote: > ​​ > baseUrl = " > http://data.parliament.uk/membersdataplatform/services/mnis/members/query"; > search_criteria = " > ​​ > House=Commons" > outputs = " > ​​ > Constituencies" > > headers = {"content-type": "application/json"} > > > *""" so

Re: [Tutor] threading tutorial

2017-06-01 Thread Jerry Hill
On Thu, Jun 1, 2017 at 11:30 AM, Michael C wrote: > Oh i get it alright, however in my code I have to push the W button like > this: > > import pyautogui > import time > > pyautogui.keyDown('w') > time.sleep(2) > pyautogui.keyUp('w') ... > theoretically deals with my problem, in practice though,

Re: [Tutor] Please explain part of this code

2017-02-20 Thread Jerry Hill
On Wed, Feb 15, 2017 at 5:37 PM, Jim wrote: > I don't recall ever seeing this before. What is this technique called? I've heard picking which function to call sometimes called "dispatching", and picking which function to call based on functions held in a dictionary called "dictionary dispatch",

Re: [Tutor] About Python Module to Process Bytes

2015-08-04 Thread Jerry Hill
On Tue, Aug 4, 2015 at 12:26 PM, Michelle Meiduo Wu wrote: > Hi there, > I'd like to find some python module to easily process bytes array data, like > encoding different types of data (char, long, short, float, etc) into a same > bytes array. I checked Python built-in library and there are byte

Re: [Tutor] Python 3 - bugs or installation problem

2015-03-05 Thread Jerry Hill
On Wed, Mar 4, 2015 at 8:53 PM, Phil wrote: > phil@Asus:~/Python$ python3 > Python 3.4.2 (default, Oct 8 2014, 13:18:07) > [GCC 4.9.1] on linux > Type "help", "copyright", "credits" or "license" for more information. for row in xrange(0,12): > ... print(row) > ... > Traceback (most recen

Re: [Tutor] about multiprocessing performance

2014-12-12 Thread Jerry Hill
On Fri, Dec 12, 2014 at 9:20 AM, Luis San Martin wrote: > I'm learning about on multiprocessing module on python. So far I've enjoyed > it though regarding performance I got some doubts. There is not that much > difference[0] when running it on Mac OS X on the contrary to Linux. > > [0] http://cod

Re: [Tutor] Useful blog post: How to debug small programs

2014-05-07 Thread Jerry Hill
On Wed, May 7, 2014 at 6:50 AM, Walter Prins wrote: > Hi all, > > I stumbled across this post today and thought it was worth sharing > with the Python tutor list. It provides good advice to students about > debugging your programs and how to ask for help on forums, in > particular Stack overflow,

Re: [Tutor] (no subject)

2014-03-21 Thread Jerry Hill
On Fri, Mar 21, 2014 at 3:25 PM, Gary Engstrom wrote: > I am trying to understand function fibc code line a,b = b, a + b and would > like to see it written line by line > without combining multiply assignment. If possible. I sort of follow the > right to left evaluation of the other code. Sure.

Re: [Tutor] How to determine which function code is being called from

2014-03-06 Thread Jerry Hill
On Thu, Mar 6, 2014 at 12:00 PM, Jignesh Sutar wrote: > Hi I'm trying to exclude a certain line of code if the function is called by > another function, see illustration below: As other have said, this is not often a good idea. That said, it is possible to inspect the call stack to see what call

Re: [Tutor] strange errors

2014-02-03 Thread Jerry Hill
On Mon, Feb 3, 2014 at 2:17 PM, Gabriele Brambilla wrote: > No, i'm not using lowlevel stuff...which part of the script do you want to > see? Since you asked, what we'd really like to see is a Short, Self Contained, Compilable Example (see http://sscce.org/). That is, an example that is short e

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Jerry Hill
On Thu, Oct 24, 2013 at 2:25 PM, bob gailer wrote: > That;s odd - since ZIP codes are character, not integer, It's not that odd. US Zip codes are a sequence of digits. I've worked with plenty of databases where ZIP codes are held in Numeric columns. It's not the ideal format for ZIP codes, bec

Re: [Tutor] Comparison Textboxes

2013-08-26 Thread Jerry Hill
On Mon, Aug 26, 2013 at 5:26 PM, taserian wrote: > Does anyone have an idea of what I'm talking about, and can you point me in > the right direction? Historically, the unix tool for comparing the differences between two files is called 'diff'. Python has similar functionality in a library called

Re: [Tutor] I have download python 3.3, then I click the link of Module Docs, but nothing appears

2013-08-20 Thread Jerry Hill
You don't give much context for your question, so I'm going to guess. You installed Python 3.3 on windows, and it installed some links in your start menu. One of those links is titled "Module Docs", and clicking on it doesn't do anything. Is that right? That seems to be the case for me too, thou

Re: [Tutor] keyboard interrupt

2013-05-23 Thread Jerry Hill
On Wed, May 22, 2013 at 9:25 PM, Dave Angel wrote: > On 05/22/2013 04:11 PM, Jerry Hill wrote: > >> The KeyboardInterrupt ​exception is raised when someone presses Ctrl-C. >> If >> you catch it, and ignore it (which is what your code above is doing), then >> press

Re: [Tutor] keyboard interrupt

2013-05-22 Thread Jerry Hill
On Wed, May 22, 2013 at 3:47 PM, Jim Mooney wrote: > I made a simple ear frequency-tester, but I don't want it to go on > forever, so I tried stopping it when I pressed a key, as below, but > that doesn't work. I did check out keyboard interrupts but they seem > unnecessarily complex just to stop

Re: [Tutor] getting TypeError: float() argument must be a string or a number

2013-04-26 Thread Jerry Hill
On Fri, Apr 26, 2013 at 8:05 PM, bob gailer wrote: > - Provide some of your program (all of it if not too long) as part of > the email body. > ​And if your program is too long to comfortably post in the body of an email​, there's some great advice about how to trim large amounts of code down to

Re: [Tutor] How to break long lines?

2013-02-22 Thread Jerry Hill
On Fri, Feb 22, 2013 at 4:26 PM, Jim Byrnes wrote: > I am cleaning up my code and have a number of sqlite3 execute statements > that extend far past 80 characters. > > From my reading implicit line joining with (), [] or {} seems to be the > preferred method, but > > cur.execute('SELECT Account FR

Re: [Tutor] Python Install Program

2012-10-05 Thread Jerry Hill
On Fri, Oct 5, 2012 at 10:39 AM, eddy van wrote: > Were can i download the python install program for free Python installers are here: http://www.python.org/download/ You'll want either version 2.7.3 or 3.3.0, depending on whether you need python 2 or python 3. The actual installer you choose w

Re: [Tutor] Help

2012-09-21 Thread Jerry Hill
On Fri, Sep 21, 2012 at 10:33 AM, Prasad, Ramit wrote: > Ironically, that describes me. So what is the preference for large > code samples? Just always include it? What about for the main list? It's tricky. Ideally, you need to take your large code base, and reduce it into a short piece of sampl

Re: [Tutor] Musical note on python

2012-09-12 Thread Jerry Hill
On Wed, Sep 12, 2012 at 8:38 AM, Dwight Hutto wrote: > If you have Windows, then you should be on the pywin32 list, I usually > assume linux on this list, but both get answered. If you're having a problem with either the specific pywin32 module[1], or have questions about accessing the deep dark

Re: [Tutor] Pygame and TkInter

2012-09-10 Thread Jerry Hill
On Mon, Sep 10, 2012 at 1:18 AM, Dwight Hutto wrote: > Please beieve me when I say use Blender, and it's Python API. It's a 3-D > app, and you can code python with it. > > The game engine will make it muche easier for you to do 'new age' gaming. I don't understand how this relates to the question

Re: [Tutor] python wifi

2012-09-06 Thread Jerry Hill
On Thu, Sep 6, 2012 at 12:43 AM, Sales wrote: > Hello, > I'm trying to install python wifi using easy install. I have python27 and > working on mac os. from a shell I'm running: > > easy_install python_wifi-0.5.0-py2.5.egg The "py2.5" in the file name suggests that you're trying to install a ver

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Jerry Hill
On Thu, Sep 6, 2012 at 10:15 AM, Ray Jones wrote: > Well, of all the. a REAL programming language. I mean, even > Bash ;;)) > > Anyway, it was a shot. Thanks. There's almost certainly a way to accomplish your goal of simplifying your giant nested if statements. It just doesn't invo

Re: [Tutor] list comprehension, testing for multiple conditions

2012-08-22 Thread Jerry Hill
On Wed, Aug 22, 2012 at 5:23 PM, Pete O'Connell wrote: > OK maybe I am wrong about it being slow (I thought for loops were > slower than lis comprehensions). But I do know I need it to be as fast > as possible if I need to run it on a thousand files each with hundreds > of thousands of lines You'

Re: [Tutor] output not in ANSI

2012-08-13 Thread Jerry Hill
On Mon, Aug 13, 2012 at 11:01 AM, leon zaat wrote: > I wrote a program for creating a csv file. > I am using pyton on windows. > The output i get is not in ANSI. I'm not familiar with an encoding that would be called ANSI, or any ANSI specification for CSV files. What, exactly, are you looking f

Re: [Tutor] The exec command and namespaces

2012-08-10 Thread Jerry Hill
On Fri, Aug 10, 2012 at 4:44 PM, Jaidev Deshpande wrote: > Hi, > > Supposed I have a string containing a python script and I exec that script. > > Is there a way to keep track of the variables that this exec() command > creates? Sure. You can provide the dictionaries that exec will use for glob

Re: [Tutor] Newline question

2012-08-03 Thread Jerry Hill
On Fri, Aug 3, 2012 at 4:18 PM, Alexander Q. wrote: > I'm following the tutorial from python.org > (http://docs.python.org/tutorial/introduction.html) and am having a few > indiscrepancies regarding the new line command. > > The tutorial says that this code > > hello = "This is a rather long strin

Re: [Tutor] How to use introspection to discover parameters?

2012-07-26 Thread Jerry Hill
On Thu, Jul 26, 2012 at 9:48 AM, David wrote: > A related question: > help() seems to do the introspection for me. Does python allow me to do it in > my own code? Specifically, how might I write my own function to mimic line 3 > of > help(), appearing like so: > my_function(logging.log) > "l

Re: [Tutor] What on earth is happening here ???

2012-07-25 Thread Jerry Hill
On Wed, Jul 25, 2012 at 11:11 AM, Lipska TheCat wrote: > def getDOMDocument(self): This defines the method getDOMDocument(). > def getDOMDocument(self, namespaceUri=__defaultNamespaceUri): This defines the method getDOMDocument(), replacing the previous definition. > def getDOMDocu

Re: [Tutor] libtiff--can't find library

2012-06-29 Thread Jerry Hill
On Fri, Jun 29, 2012 at 12:33 PM, R Bruce van Dover wrote: > Presumably this is a newbie question; apologies in advance, but I have spent > hours trying to RTFM, to no avail. Can anyone help? There's an issue on the pylibtiff Issues page that sounds related: http://code.google.com/p/pylibtiff/iss

Re: [Tutor] Opening filenames with unicode characters

2012-06-28 Thread Jerry Hill
On Thu, Jun 28, 2012 at 3:48 PM, James Chapman wrote: > Informative thanks Jerry, however I'm not out of the woods yet. > > >> Here's a couple of questions that you'll need to answer 'Yes' to >> before you're going to get this to work reliably: >> >> Are you familiar with the differences between b

Re: [Tutor] Opening filenames with unicode characters

2012-06-28 Thread Jerry Hill
On Thu, Jun 28, 2012 at 2:55 PM, James Chapman wrote: > Why can I not convert my existing byte string into a unicode string? That would work fine. > In the mean time I'll create my original string as unicode and see if that > solves my problem. > fileName = unicode(filename) > > Traceback (

Re: [Tutor] Opening filenames with unicode characters

2012-06-28 Thread Jerry Hill
On Thu, Jun 28, 2012 at 1:55 PM, James Chapman wrote: > Thanks Tim, while this works, I need the name to be stored in a variable as > it's dynamic. > > In other words, how do I rewrite > open(u"blah£.txt") > > to be > filename = "blah£.txt" > open(filename) You have to create a unicode-string, no

Re: [Tutor] special attributes naming confusion

2012-06-06 Thread Jerry Hill
On Wed, Jun 6, 2012 at 4:32 PM, Dave wrote: > I'm not sure where this comment belongs, but I want to share my perspective > on the documentation of these special method names. In the following section > there is an inconsistency which could be confusing to someone just learning > Python (e.g., me)

Re: [Tutor] pip errors for numpy, scipy matplotlib

2012-05-11 Thread Jerry Hill
On Fri, May 11, 2012 at 2:42 PM, Bjorn Madsen wrote: > Hi, > when attempting to use pip to install numpy, scipy matplotlib I get a mile > of errors. There is simply too much information printed - so it must be a > systematic error (http://paste.ubuntu.com/982180/). What am I missing/doing > wrong?

Re: [Tutor] List Indexing Issue

2012-05-08 Thread Jerry Hill
On Tue, May 8, 2012 at 4:00 PM, Spyros Charonis wrote: > Hello python community, > > I'm having a small issue with list indexing. I am extracting certain > information from a PDB (protein information) file and need certain fields of > the file to be copied into a list. The entries look like this:

Re: [Tutor] How to exit this loop in the interpreter

2012-05-03 Thread Jerry Hill
On Thu, May 3, 2012 at 9:57 AM, wrote: > Hello all, > > I have encountered the following scenario. > Here is the code - on IDLE on Windows XP. > while True: >     try: >         number = raw_input("enter number - ") >         print number * number >     except ValueError: >         print "in

Re: [Tutor] is it possible to create and amend classes during run-time?

2012-05-02 Thread Jerry Hill
On Wed, May 2, 2012 at 3:56 PM, Bjorn Madsen wrote: > Hi, > I have been studying http://docs.python.org/tutorial/classes.html for a > while, but still have two questions which I could not answer. Perhaps you > could help? > > Does anyone know if it is possible during run-time to: > a) add attribut

Re: [Tutor] need help with a script..

2012-04-11 Thread Jerry Hill
On Wed, Apr 11, 2012 at 9:50 AM, Khalid Al-Ghamdi wrote: > Hi All, > > I'm using python 3.2 on a windows xp. > > I wrote the below script and ran it with the hope of returning a list of > proctors (list_proc), but when it runs it  doesn't call the function > convert_proctors() as intended. On the

Re: [Tutor] how to build a multiplayer game?

2012-04-11 Thread Jerry Hill
On Wed, Apr 11, 2012 at 9:30 AM, Surya K wrote: > Well, can we make the program so that user enters his IP, DNS addresses > before starting? You could, sure. That's fine for testing purposes, but most people don't know their own IP addresses. Many people don't have a DNS entry for their home PC

Re: [Tutor] creating dict of dict : similar to perl hash of hash

2012-03-06 Thread Jerry Hill
On Tue, Mar 6, 2012 at 6:21 PM, Alan Gauld wrote: > But it doesn't have the same dynamic depth that the Perl version has, you > need to know your maximum depth. The last level will always have the default > set to None. > > You could create a class subclassed from defaultdict that would do it > th

Re: [Tutor] number of mismatches in a string

2012-03-02 Thread Jerry Hill
On Fri, Mar 2, 2012 at 2:11 PM, Hs Hs wrote: > Hi: > I have the following table and I am interested in calculating mismatch > ratio. I am not completely clear how to do this and any help is deeply > appreciated. > > Length     Matches > 77      24A0T9T36 > 71      25^T9^T37 > 60      25^T9^T26 > 6

Re: [Tutor] Create a table by writing to a text file.

2012-02-22 Thread Jerry Hill
On Wed, Feb 22, 2012 at 10:24 AM, David Craig wrote: > you had me worried for a minute, but > a = [[]] * 3 > a[0]=[1,2,3] > a > [[1, 2, 3], [], []] > That's not the same thing. In your example you create three copies of the same empty list inside your outer list. You then throw away the first

Re: [Tutor] __name__=='__main__'

2012-02-20 Thread Jerry Hill
On Mon, Feb 20, 2012 at 6:46 PM, Michael Lewis wrote: > I at first put it outside and after all my functions but got the error below That's the right place for it, you just spelled it wrong. > and then put it inside my last function and the program ran. That's not the right place for it. Your

Re: [Tutor] (no subject)

2012-02-08 Thread Jerry Hill
On Wed, Feb 8, 2012 at 5:21 PM, Joel Goldstick wrote: > The else clause runs if the loop breaks for some reason. So you would > use it only to do some processing if the loop completes completely. > > No. The else clause only runs if the loop does NOT break out early. The else clause only runs i

[Tutor] For/Else loops

2012-02-07 Thread Jerry Hill
On Tue, Feb 7, 2012 at 1:50 PM, Debashish Saha wrote: > for i in range(1, 8): >    print(i) >    if i==3: >        break > else: >    print('The for loop is over') > > >  Output: > 1 > 2 > 3 > > Question:but after breaking the for loop why the else command could not work? Because that's the way a

Re: [Tutor] New user Knows nothing about python I Need HELP

2012-01-30 Thread Jerry Hill
On Mon, Jan 30, 2012 at 2:02 PM, William Stewart wrote: > I have no Idea how to start this task I have never used ANY programming > programs before And I dont Know the language either > The online help files from python Did not help a bit Here's a few resources that might get you started. Firs

Re: [Tutor] finding a polymer of letters in a string

2012-01-19 Thread Jerry Hill
On Thu, Jan 19, 2012 at 1:44 PM, Hs Hs wrote: > so I do not know what that pattern would be when I read in a string. I do > not know if regex could solve my kind of problem too. > Ignore the python portion of the problem for now. Imagine someone handed you a piece of paper with the letters "AAA

Re: [Tutor] Installing Modules

2012-01-18 Thread Jerry Hill
On Wed, Jan 18, 2012 at 1:07 PM, Downey, Patrick wrote: > I'm currently running Python version 2.7 through IDLE on a Windows machine. > I'm trying to use numpy and scipy. I downloaded both modules from the scipy > website and unzipped the files into: > C:\Python27\Lib\site-packages > That is not

Re: [Tutor] Beginner Exercise: Why Didn't I Break It?

2011-12-20 Thread Jerry Hill
On Tue, Dec 20, 2011 at 12:31 PM, Homme, James wrote: > So far, the data types this little book has talked about are strings and > numbers. ... > return jelly_beans, jars, crates ... > # It returns three things in parentheses, which, I guess is one group of > things. I thought it would complain.

Re: [Tutor] Request for guidance about a python syntax

2011-12-19 Thread Jerry Hill
On Mon, Dec 19, 2011 at 12:10 PM, Peter Otten <__pete...@web.de> wrote: > Close, but % and * have the same operator precedence. Therefore the > expression > > "%dH" % nframes * nchannels > > is evaluated as > > (%dH" % nframes) * nchannels > > Thanks Peter, that's exactly correct. Maybe this will

Re: [Tutor] Request for guidance about a python syntax

2011-12-19 Thread Jerry Hill
On Mon, Dec 19, 2011 at 10:54 AM, Ganesh Borse wrote: > I could know the use of unpack_from, but I could not understand the "fmt" > part, i.e *"%dH" % nframes * nchannels*. > Can you pls help me know, what is the purpose of two "%" signs in this > statement? > > That's python's string formatting.

Re: [Tutor] Python Windows Vista Installation Question

2011-12-09 Thread Jerry Hill
On Fri, Dec 9, 2011 at 1:41 PM, Homme, James wrote: > Can Python easily be installed on a Windows Vista computer without needing > administrative rights to that machine? > I thought the standard installer worked for non-admin installs, as long as you select "Just for me" instead of "All users on

Re: [Tutor] In a pickle over pickles….Python 3

2011-11-18 Thread Jerry Hill
On Fri, Nov 18, 2011 at 11:12 AM, Joe Batt wrote: > > pickledfile=open('///Users/joebatt/Desktop/python/pickledpuzzle5.txt','w') > pickle.dump(filecontents,pickledfile) > pickledfile.close() > > A pickle is a binary object, so you'll need to open your picklefile in binary mode: pickledfi

Re: [Tutor] Cython vs Python-C API

2011-11-14 Thread Jerry Hill
On Mon, Nov 14, 2011 at 3:30 PM, Jaidev Deshpande < deshpande.jai...@gmail.com> wrote: > Hi > > I need to perform cubic spline interpolation over a range of points, and I > have written the code for the same in C and in Python. > > The interpolation is part of a bigger project. I want to front end

Re: [Tutor] Find all strings that....

2011-11-11 Thread Jerry Hill
On Fri, Nov 11, 2011 at 1:21 PM, Francesco Loffredo wrote: > Anyway, taking for granted the rules contained in the edit distance > definition (Thank you, Steven!), I think that finding in a given set S all > words that can be converted into some given "target" with at most N such > operations (be

Re: [Tutor] longest common substring

2011-11-11 Thread Jerry Hill
There's nothing wrong with writing your own code to find the longest common substring, but are you aware that python has a module in the standard library that already does this? In the difflib module, the SequenceMatcher class can compare two sequences and extract the longest common sequence of el

Re: [Tutor] String encoding

2011-08-26 Thread Jerry Hill
On Thu, Aug 25, 2011 at 7:07 PM, Prasad, Ramit wrote: > Nice catch! Yeah, I am stuck on the encoding mechanism as well. I know how to > encode/decode...but not what encoding to use. Is there a reference that I can > look up to find what encoding that would correspond to? I know what the > chara

Re: [Tutor] which version do i have and how do i change it

2011-08-16 Thread Jerry Hill
On Tue, Aug 16, 2011 at 4:35 PM, Lisi wrote: > lisi@Tux:~$ aptitude why python > i   reportbug Depends python (>= 2.5) > lisi@Tux:~$ Keep in mind that that command only shows you a single dependency chain. Try again with "aptitude -v why python" to see all of the dependencies. On my ubuntu 11.0

Re: [Tutor] trying to translate and ebcidic file

2011-06-14 Thread Jerry Hill
On Tue, Jun 14, 2011 at 2:40 PM, Prinn, Craig wrote: > I am looking for a way to translate and ebcidic file to ascii. Is there a > pre-existing library for this, or do I need to do this from scratch? If from > scratch and ideas on where to start? If the file is essentially a text file, I would re

Re: [Tutor] lxml.html

2011-06-08 Thread Jerry Hill
On Wed, Jun 8, 2011 at 11:20 AM, nitin chandra wrote: > Hello Every One, > >         doc = lxml.html.parse('/home/dev/wsgi-scripts/index.py').getroot() Is index.py really an XML document? If so, it's named pretty oddly... -- Jerry ___ Tutor maillist

Re: [Tutor] reading very large files

2011-05-17 Thread Jerry Hill
On Tue, May 17, 2011 at 1:20 PM, Vikram K wrote: > I wish to read a large data file (file size is around 1.8 MB) and manipulate > the data in this file. Just reading and writing the first 500 lines of this > file is causing a problem. I wrote: ... > > Traceback (most recent call last): >   File >

Re: [Tutor] Pygame install help

2011-03-28 Thread Jerry Hill
On Sun, Mar 27, 2011 at 1:31 PM, Chuck wrote: > Does anyone have familiarity with installing pygame? It seems simple and > straight forward enough, then why do I get the following from IDLE? This is > the 3.1 Windows pygame .msi install... You're using pygame (probably pygame 1.9.1) built for pyt

[Tutor] Homework and the Tutor list

2011-02-02 Thread Jerry Hill
>    I would have to agree with you Ian.  Coming from an art then computer > animation visual effects background, it's not until recently that it became > evident to me that in order to push the potential of this medium, I would > definitely have to learn to code.  I think the stigma of the "homewo

Re: [Tutor] The trap of the year

2011-01-25 Thread Jerry Hill
On Tue, Jan 25, 2011 at 3:41 PM, Karim wrote: > I am not really understanding why my init in the class made it refers to > the same list object. > What is the difference with 2nd example directly at the prompt? > See http://effbot.org/zone/default-values.htm -- Jerry __

Re: [Tutor] Importing packages

2011-01-21 Thread Jerry Hill
On Fri, Jan 21, 2011 at 4:10 AM, arun kumar wrote: > Hi, > > I'm trying to program with gdata > (http://code.google.com/p/gdata-python-client/) using python > library.I'm having problem in writing import statements. Have you read the Getting Started document linked from their wiki? Particularly,

Re: [Tutor] Save file in a specific directory

2010-12-07 Thread Jerry Hill
> When I run the script I got the next error: import crawler_shp > Traceback (most recent call last): >   File "", line 1, in >   File "crawler_shp.py", line 105, in >     dbf = Dbf(d,new=False) >   File "C:\Python26\lib\site-packages\dbf.py", line 125, in __init__ >     self.stream = file(f

Re: [Tutor] floats

2010-12-03 Thread Jerry Hill
On Fri, Dec 3, 2010 at 1:52 PM, Christopher Spears wrote: float_a = 1.16667 > > However, I want to pass the value of float_a to float_b, but I want the float > to be accurate to two decimal points. Use the built-in round() function, like this: >>> a = 1.16667 >>> print a 1.16667 >>> b = ro

Re: [Tutor] How to handle exceptions raised inside a function?

2010-11-30 Thread Jerry Hill
On Tue, Nov 30, 2010 at 3:00 PM, Richard D. Moores wrote: > Both Hlist and Glist must contain only positive numbers, so I really > need to test for this inside each function. But is there a good way to > do this? What should the functions return should a non-positive number > be detected? Is there

Re: [Tutor] 'pydoc' is not recognized as an internal or external command, ...

2010-11-12 Thread Jerry Hill
On Fri, Nov 12, 2010 at 6:44 PM, Steven D'Aprano wrote: > Use the Find File command, and see if you can find something called "pydoc". > You may need to call the full path to the program, e.g.: > > C:\My Documents\path\to\program\pydoc raw_input On my windows PC, it's c:\Python31\Lib\pydoc.py So

Re: [Tutor] function with multiple checks

2010-09-27 Thread Jerry Hill
On Mon, Sep 27, 2010 at 11:09 AM, Tim Miller wrote: > I've got a small function that I'm using to check whether a password is of a > certain length and contains mixed case, numbers and punctuation. > > Originally I was using multiple "if re.search" for the patterns but it > looked terrible so I've

Re: [Tutor] Elementtree and pretty printing in Python 2.7

2010-08-22 Thread Jerry Hill
On Fri, Aug 20, 2010 at 3:49 AM, Knacktus wrote: > Hi guys, > > I'm using Python 2.7 and the ElementTree standard-lib to write some xml. > > My output xml has no line breaks! So, it looks like that: > > > > instead of something like this: > > >     > > > I'm aware of lxml which seems to have a

Re: [Tutor] Questions regarding strings

2010-08-09 Thread Jerry Hill
On Sun, Aug 8, 2010 at 1:04 PM, Daniel wrote: > > Can someone please explain this to me? Thank you so much and I wish everyone > a great day! Beyond what Hugo mentioned in his message, take a look at the tutorial: http://docs.python.org/tutorial/introduction.html#strings I don't see a way to di

Re: [Tutor] access class through indexing?

2010-08-04 Thread Jerry Hill
On Wed, Aug 4, 2010 at 5:28 PM, Alex Hall wrote: > Here is my init, not half as pretty as yours, but it should work. > Maybe this will explain the problem. > > def __init__(self, size, cards=None, fill=False): > #creates a pile of cards. If "fill"==true, it will auto-fill the > pile starting fro

Re: [Tutor] access class through indexing?

2010-08-04 Thread Jerry Hill
On Wed, Aug 4, 2010 at 4:17 PM, Alex Hall wrote: > Hi all, > Further to my questions about overriding builtin methods earlier, how > would I make a class able to be accessed and changed using index > notation? For example, take the following: > deck=CardPile(52) #creates a new deck of cards > pri

Re: [Tutor] A unicode print question

2010-07-30 Thread Jerry Hill
On Fri, Jul 30, 2010 at 1:33 PM, Joel Goldstick wrote: > I was reading this: http://diveintopython.org/xml_processing/unicode.html > > and tried the exercise: > > But oddly enough, when I typed it into my python shell I did NOT get the > UnicodeError, and I wonder why not: > I believe that pyth

Re: [Tutor] Problems installing

2010-06-30 Thread Jerry Hill
On Wed, Jun 30, 2010 at 1:35 AM, Andrew Martin wrote: > I just downloaded Python 2.6.5 onto my windows vista laptop. I am > attempting to install "escript version 3: Solution of Partial Differential > Equations (PDE) using Finite Elements (FEM)." I downloaded the files and > manually placed them i

Re: [Tutor] Using Regex to produce text

2010-04-28 Thread Jerry Hill
On Wed, Apr 28, 2010 at 2:27 AM, wrote: > Is there an way of using the regex patterns to produce text, instead of > matching it? There have been some previous discussions about generating all of the possible matches for a given regular expressions. I believe these are the first messages in a c

Re: [Tutor] smtplib help required

2010-04-23 Thread Jerry Hill
On Fri, Apr 23, 2010 at 6:41 PM, James Chapman wrote: > Hi there gurus and everyone else. This is my first post to this group, and > I'm turning here because I'm stumped and search engines are not helping. > I've used smtplib for a few things already and while wanting to use it again > today, I'm

Re: [Tutor] the binary math "wall"

2010-04-20 Thread Jerry Hill
On Tue, Apr 20, 2010 at 12:58 PM, Lowell Tackett wrote: > Any of Python's help-aids that I apply to sort things out, such as formatting > (%), or modules like "decimal" do nothing more than "powder up" the display > for visual consumption (turning it into a string).  The underlying float > valu

Re: [Tutor] Curses - What does it do and why is it called this?

2009-10-22 Thread Jerry Hill
On Tue, Oct 13, 2009 at 3:11 AM, Katt wrote: > Now I understand.  Makes sense.  If "Curses" is for UNIX what would I use on > a Windows XP system using Python 2.6.2? I like the Console package: http://effbot.org/zone/console-index.htm -- Jerry ___ Tut

Re: [Tutor] Which version to start with?

2009-10-06 Thread Jerry Hill
On Tue, Oct 6, 2009 at 8:59 AM, Ken G. wrote: > I am just starting on Python 2.6.2 on Ubuntu 9.04 and I am slightly confused > with the numerous tutorials and books available for learning the language. > Is there any good recommendation for a good but easy tutorial on the > Internet to learn Pytho

Re: [Tutor] Simple regex replacement match (converting from Perl)

2009-09-04 Thread Jerry Hill
On Fri, Sep 4, 2009 at 1:34 PM, GoodPotatoes wrote: > I simply want to remark out all non-word characters read from a line. > > Line: > Q*bert says "#...@!$%  " > > in Perl > #match each non-word character, add "\" before it, globally. > > $_=s/(\W)/\\$1/g; > > output: > Q\*bert\ says\ \"\...@\!\$\

Re: [Tutor] New Issues with REGEX Greediness:

2009-08-03 Thread Jerry Hill
On Sun, Aug 2, 2009 at 2:55 PM, gpo wrote: > > Python: > line='>Checking Privilege for UserId: > {874BE70A-194B-DE11-BE5C-000C297901A5}, PrivilegeId: {prvReadSdkMessage}. > Returned hr = 0' > (re.search('(\w+)\:.+.{8}-.{4}-.{4}-.{4}-.{12}',line)).group(0) > RESULT > 'UserId: {874BE70A-194B-DE11-BE5

Re: [Tutor] Deleting recursive folder definition

2009-01-12 Thread Jerry Hill
On Mon, Jan 12, 2009 at 2:07 PM, Alan Gauld wrote: > I've managed to do something incredibly stupid on my XP box. > I've created a folder that is a link to itself - at least I think that's > what has > happened, it was a CASE tool that I was using that actually did the damage. Try exploring the o

Re: [Tutor] /not/ instanciating

2008-11-17 Thread Jerry Hill
On Sun, Nov 16, 2008 at 2:57 PM, spir <[EMAIL PROTECTED]> wrote: > * Why, then, is __init__ still executed when the instanciated object is > 'manually' returned? What's the use of that feature? The manual (http://www.python.org/doc/2.5.2/ref/customization.html) says: "If __new__() returns an insta

Re: [Tutor] accessing an image with pygame.image.load()

2008-11-03 Thread Jerry Hill
On Mon, Nov 3, 2008 at 7:05 PM, bob gailer <[EMAIL PROTECTED]> wrote: > Christopher Spears wrote: >> self.image = >> pygame.image.load("C:Users\Chris\Documents\python\assignment07\chris_graphics\spaceship.gif") >> > > Since \ is used to "escape" certain characters it is advisable to either use > \\

Re: [Tutor] how to read over serial port

2008-11-03 Thread Jerry Hill
On Mon, Nov 3, 2008 at 4:08 PM, shawn bright <[EMAIL PROTECTED]> wrote: > yes, they look like this > �� > > so i used your print repr(chr(ord(i))) and got this Note that that's the same thing as just printing repr(i). > so, what do i do now? > and thanks for the info, by the w

Re: [Tutor] Iterate over multiple objects

2008-10-29 Thread Jerry Hill
On Wed, Oct 29, 2008 at 7:30 AM, W W <[EMAIL PROTECTED]> wrote: > I'm trying to compare two strings because I want to find the difference. Albert pointed you to zip so that you can iterate through the two strings in lockstep. You may also want to investigate the python difflib module in the stand

[Tutor] Python in a web browser (was Re: finding numbers in range of of numbers)

2008-10-21 Thread Jerry Hill
On Tue, Oct 21, 2008 at 2:26 PM, Richard Lovely <[EMAIL PROTECTED]> wrote: > I don't have internet access, and I've yet to find a public computer > with Python, so I'm unable to test any code I write. I'm going have > to discpline myself not to post to here unless its: a) a problem of my > own, or

Re: [Tutor] appending to a utf-16 encoded text file

2008-10-21 Thread Jerry Hill
On Tue, Oct 21, 2008 at 9:52 AM, Tim Brown <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to create and append unicode strings to a utf-16 text file. > The best I could come up with was to use codecs.open() with an > encoding of 'utf-16' but when I do an append I get another UTF16 BOM > put into the

Re: [Tutor] cx_oracle module problems

2008-10-07 Thread Jerry Hill
On Tue, Oct 7, 2008 at 2:46 PM, jeremiah <[EMAIL PROTECTED]> wrote: > I've downloaded the cx_oracle source module for python, howerver every > time i try to build it, it keeps on failing. I've been unable to find a > port for Ubuntu. Is there one? Anyone know how to get this properly > installed? >

Re: [Tutor] re.compile concatenating two searh words

2008-09-29 Thread Jerry Hill
On Mon, Sep 29, 2008 at 6:19 PM, Srinivas Iyyer <[EMAIL PROTECTED]> wrote: > Hi Tutors, > I have a list with elements as strings. I want to search if any of these > element strings has two words of my interest. How can I ask re.compile to > look for both words. > > my words are 'good' and 'bad'.

Re: [Tutor] image processing

2008-09-23 Thread Jerry Hill
On Tue, Sep 23, 2008 at 5:38 PM, jeremiah <[EMAIL PROTECTED]> wrote: > I'm trying to do simple image manipulation but am getting an error. any > ideas what i am doing wrong here? > > file=open("./"+name,"w") > pic=Image.open(file) You're opening the file for "w"riting, then asking PIL to read it.

Re: [Tutor] Sort Output

2008-09-17 Thread Jerry Hill
On Wed, Sep 17, 2008 at 3:30 PM, Wayne Watson <[EMAIL PROTECTED]> wrote: > I'm using Python 2.4 in Win XP. I was surprised to find the result below. > a =[4,2,5,8] b = a This binds the name "b" to the same object that "a" is bound to. a.sort() a > [2, 4, 5, 8] b > [2, 4,

Re: [Tutor] list slice

2008-09-15 Thread Jerry Hill
On Mon, Sep 15, 2008 at 10:56 AM, Norman Khine <[EMAIL PROTECTED]> wrote: > Hello, > I have this code: > > topics = object.parent.get_topics() >for i, topic in enumerate(topics): >all_previous_topics = topics[:i] >print all_previous_topics > > where topics returns a

Re: [Tutor] Python Docs (Was: Reformatting phone number)

2008-08-21 Thread Jerry Hill
On Thu, Aug 21, 2008 at 12:01 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote: > 2008/8/21 Kent Johnson <[EMAIL PROTECTED]>: >> Chapters 2 and 3 of the library reference are highly recommended. >> http://docs.python.org/lib/lib.html > > Let's start from there. I need the startswith() function, but I do n

Re: [Tutor] where to report a bug?

2008-07-25 Thread Jerry Hill
On Fri, Jul 25, 2008 at 10:04 AM, Rick Pasotto <[EMAIL PROTECTED]> wrote: > I have a script that works fine on my linux machine but bombs out when > run under windows using the exact same data files. The script downloads > a file then unzips it and then scans the resulting file for certain > record

  1   2   >