> I have downloaded win32, win32com, Preppy and PIL. I have had a go at
> using them but can't get them to work. At the moment I can't even print
> the text file.
>
> Is there a good helpguide/FAQ page which deals with printing text files
> or is there simple code which prints a text file?
Hi
> Dec 18 10:04:45 dragon logger: TCPWRAP: SERVICE=sshd@:::192.168.0.1
> ,TYPE=ALL_DENY,HOST_ADDRESS=:::195.145.94.75,HOST_INFO=:::
> 195.145.94.75,HOST_NAME=unknown,USER_NAME=unknown,OTHERINFO=
Hi Will,
Observation: the output above looks comma delimited, at least the stuff
after the
Hi William,
Here are some constructive comments on the program; if you have questions
on any of it, please feel free to ask.
> def fileScramble(fileName):
We may want to rename "fileName" to something else, as it isn't being
treated as a filename, but more like a file-like object. Good names
> I just tried out sets for the first time, and I'm finding multiple uses
> for them, particularly for replacing and simplifying what would normally
> be one or two list comprehensions i.e.
>
> def parseKws(self, kw_data):
> ignoreSet = set(['import', 'from', 'as', ' ', ''])
>
> ok so assuming I had a dictionary with 1key that contained a list like
> so... dictionary[key1][0]
>
> How would I increment it or assign it if it didn't exist. I assumed like
> this. dict[key1][0] = dictionary.get(key1[0],0) + X
Hi Paul,
Given a dictionary d and some arbitrary key k, let's ass
> >>> import re
> >>> file = open("file1.html")
> >>> data = file.read()
> >>> catRe = re.compile(r'Title:(.*?)')
>
> # I searched around the docs on regexes I have and found that the "r"
> # after the re.compile(' will detect repeating words.
Hi Oswaldo,
Actually, no. What you're seeing is a "
> Anothet linux noobie here :)
> How do I uninstall python? I use the SimplyMepis flavor of linux.
Hi Hans,
Ask the Mepis folks about this. I understand that Mepis is a Debian-based
distribution, and you should be able to use the 'dpkg' command to drop
debs.
That being said, I have no idea if M
> Do you know of any Tutor-like list for Java you could recommend? I've
> been looking and I've been unable to find any... and i miss it :-)
Hi Guillermo,
The Java community uses a lot of web forums. Your best bet is probably
one of the 'Fundamentals' forums in:
http://forum.java.sun.com/i
> > > I also found that on some of the strings I want to extract, when
> > > python reads them using file.read(), there are newline characters
> > > and other stuff that doesn`t show up in the actual html source.
> >
> > Not certain that I understand what you mean there. Can you show us?
> > read(
> > category = m.group(1)
> > >
> > > Traceback (most recent call last):
> > > File "", line 1, in ?
> > > AttributeError: 'NoneType' object has no attribute 'group'
> >
> > In this case the match failed, so m is None and m.group(1) gives an
> >error.
>
> So my problem is in the actual regex?
> Everytime the program has to add a line is added to the file, the file
> is open, appended, then closed, in order to be able to read it at any
> point in time. This set of operations can happen several times a second,
> like 1-10 or so. In this case, every query to a MySQL database is
> printed
> I think I see where you are going with this. Are you suggesting that
> both parent and child thread might be trying to write to the log at
> once, and one of them is closing the file while it is open for both?
Hi Bernard,
One possibility is that we have a shared resource that needs some kind o
> I am trying to write a program in which it ask for entries for the list
> , But if I press Enter it should exit the while loop without giving
> errors
Hi John,
Do you have ideas why it's getting an error? Can you point at the part of
the program that's receiving the "Enter"?
As a related qu
On Tue, 3 Jan 2006, Lance E Sloan wrote:
> A colleague of mine often develops Python code under Mac OS X. He would
> like to be able to print the code in an easily readable format. He's
> found that kwrite on Linux does a very nice job, but it's inconvenient
> to copy his code to a Linux box j
On Tue, 3 Jan 2006, lfiedor wrote:
> im looking for very simple DES and RSA algorithms writen in python (or
> C), can anyone know where i can find them
I'm changing subject lines. Please try to make your message Subject lines
descriptive enough to make it easier to find later.
Also, next time
On Tue, 3 Jan 2006, Jason Massey wrote:
> I've just finished ripping out a bunch of lines in one of my wxPython
> programs. Testing it out I get:
>
> C:\Python24>tla2.py
> File "C:\Python24\tla2.py", line 412
> self.grid.SetCellValue(0,0,"Site")
> ^
> SyntaxError: invalid syntax
>
> T
> i'm a totally newbie to python, but i can't resist to try to communicyte
> with an ICQ-server via my own tool.
>
> now i have the problem that i should encrypt a string (the password) by
> XOR with this bytes: f3, 26, 81, c4, 39, 86, db, 92, 71, a3, b9, e6, 53,
> 7a, 95, 7c.
Hello Tobi,
Accor
> rn200.bbfxa.com Wed Jan 4 16:23:36 2006 [jobid: 9]: Get status of all
> local jobs for this job...
>
> *** glibc detected *** double free or corruption: 0x09484d58 ***
> Aborted
Hi Bernard,
Ugh. I hate memory allocation bugs.
Is it reproducable? Can you run this through a debugger like GDB
On Wed, 4 Jan 2006, to bifu wrote:
> thanks for the help, but my problem is how to use that for a string,
Hi To,
A character can be translated into an ordinal number by using the ord()
function. For example:
##
>>> ord('a')
97
##
> and those hexadecimals are confusing me, too.
Let
> Instead of writing a new 'for,if' loop to filter the repetetive tags
> from the list, is there something that I can add in the re itself to
> match the pattern only once?
Hi Intercodes,
As far as I know, no: regular expressions don't have the capacity to
remember what tags they've matched in p
> >From a technical standpoint, it has "quadratic" complexity in terms of
> what work the computer is doing. It's related to the mathematical idea
> that 1 + 2 + 3 + 4 + ... + n = n(n+1).
>
> http://en.wikipedia.org/wiki/Triangle_number
Gaa, where did my division sign go? *grin*
Sorry, tha
-- Forwarded message --
Date: Fri, 6 Jan 2006 01:53:41 +0530
From: Intercodes <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Avoiding repetetive pattern match in re module
Hello Danny,
Thanks for the response. The read() and join() method
On Thu, 5 Jan 2006, Boyan R. wrote:
> I need program to convert my string in integer.
> I remember in BASIC I used val(string) command
> Is there a Python equivalent ?
>
> Here is how it should work:
> val(7) = 7
> val(bbab7) = 7
> val(aa7aa) = 7
> val( 7) = 7
Hi Boyan,
Python has a functi
> >From that, you should be able to easliy produce a tab delimited file
> (or anything else you want).
There's even a 'csv' module in Python's Standard Library to handle some of
the awkward cases in generating tab-delimited data:
http://www.python.org/doc/lib/module-csv.html
On Fri, 6 Jan 2006, Srinivas Iyyer wrote:
> Hi Danny,
>
> I was following some of your suggestions in making my IDLE work in
> Windows XP laptop.
> (http://mail.python.org/pipermail/tutor/2005-January/034683.html).
Hi Srinivas,
That suggestion, to change the desktop shortcut, wasn't mine. *gr
> lot for the advice I got my concepts of def of functions , sort
> functions , count , cleared for me
>I was able to do and understand all the
> function example , except �item_comparison� function
>I get the error for set
> >>> set((1,1,1,2,2,2,2,2,3,4,4,5))
> Trac
On Tue, 10 Jan 2006, bill nieuwendorp wrote:
> I am trying to convert binary file to ascii
>
> here is the format spec
>
> steps = int 4
> value = int 4
> time = float 4 * steps
Hi Bill,
Ok, that structure seems fairly simple so far.
> >>> import struct
> >>> import string
> >>> f = file('b
On Wed, 11 Jan 2006, Burge Kurt wrote:
> I f I want to translate C code to Python and have a function like
>
> void get_args(int argc, char* argv[], Argument* args)
> {
Hi Burge,
Also wanted to note that the Standard Library already contains an
argument-parsing library, so you may want to tak
On Thu, 12 Jan 2006, Burge Kurt wrote:
> How can I use calloc in python ? Before computing and processing my data
> I want to know how many bytes are available?
Hi Burge,
There's no concept of manual memory allocation in Python, and we don't
have direct access to calloc/malloc/free.
You're as
On Thu, 12 Jan 2006, Burge Kurt wrote:
> Again thank you :( and sorry for asking that much questions in one day
> and I know most of them were nonsense ..
Don't worry about it; please feel free to continue to ask questions on the
list. It wasn't quite clear what experience you had before: I ha
On Thu, 12 Jan 2006, David Christian wrote:
> Thanks in advance for any help!How do you create a script in
> python...sorry to be so remedial...first script.
You might want to look at:
http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/
Some of the information there is a bit outdated, b
On Thu, 12 Jan 2006, Christopher Spears wrote:
> I just read about __init__ in the chapter on operator
> overloading in Learning Python. What is __init__
> exactly? Is it a special function that you can use to
> initialize attributes in an object upon creation?
Hi Chris,
Yes, that's it.
__i
On Fri, 13 Jan 2006, S. D. Rose wrote:
> One thing about classes that really tripped me up when I first started
> using classes was 'self' before the variable. When you have '
> self.variable ' that is a variable that can be referenced by the parent.
> If there's no 'self' before the variable,
> On 16/01/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> > No. JavaScript is an event driven paradigm and it only picks up the
> > explicit events you register with it(*). One of the problems of using
> > CGI is the ese of frigging it. I assume you are using GET instead of
> > POST? GET is the defaul
> Want I want though is to do this with MARRFONT.TTF. That is a (free) font
> that has chesspieces inside. (can be downloaded here:
> http://antraxja-fonts.iweb.pl/pobierz.php?font=3903 )
Hi Rinzwind,
You might want to contact the folks who make that font: according to the
Fontbook on my Mac OS X
On Mon, 16 Jan 2006, Christopher Spears wrote:
> I'm not sure if I understand __iter__. You use it to create an object
> that iterates through itself using a next menthod ?
Hi Chris,
Yes, that's one application.
But __iter__() doesn't necessarily have to return 'self'. For example,
here's
-- Forwarded message --
Date: Tue, 17 Jan 2006 09:47:58 +0100
From: Rinzwind <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: PIL, fonts and making images
That's not good.
Well I guess it does what it is suppose to do: make it able to create
> One small correction: Pointer should have an __iter__() method that
> returns self; this is part of the iterator protocol. See PEP 234
> http://www.python.org/peps/pep-0234.html
Hi Kent,
Ah, thank you! Ok, the corrected code is:
#
class MyListOf
> Where/how/when is 'def next(self(:' called?
The 'for' loop statement does this internally when it marches across an
iterable thing. We can write something something like this:
##
for item in thing:
print item
##
Python is doing something like this
> > My problem is I want to make a string object into a reference to
> > another object. To be more specific, I'm reading through a text file
> > of amino acids. The first item on each line is the amino acid name,
> > and a later item is its exposed surface area.
Hi Victor,
It sounds like we'd
> > The terminology that the original poster uses ("references to another
> > object") sounds a lot like the original usage of symbolic "soft"
> > references in Perl.
> > (http://www.perl.com/doc/manual/html/pod/perlref.html)
> >
> > Perl programmers, for the most part, avoid them now because they'
On Tue, 17 Jan 2006, andy senoaji wrote:
> I'm back to my home machine, and ran again the open method, just to test
> my sanity Here are the results:
[cut]
Hi Andy,
Unfortunately, there are a few things that might be happening here. You
mentioned earlier that:
> I know for sure that the fil
On Thu, 19 Jan 2006, Hans Dushanthakumar wrote:
> Try this:
>
> print word[::-1]
Hi Hans and Adam,
Just wanted to point out: next time, let's try to figure out why Ryan had
problems with this, rather than directly give a working answer.
For example, we can ask things like: what part did Ryan
On Wed, 18 Jan 2006, ryan luna wrote:
> Ok so what i have to do is make it so when a player ask for a hint the
> program display a hint, heres my loop, not whole script.
>
> guess = raw_input("\nYour guess: ")
> guess = guess.lower()
> while (guess != correct) and (guess != ""):
> print "Sor
> > There are tradeoffs here. On the one hand, Python folks get caught
> > off guard when they first encounter list aliasing. On the other, Perl
> > folks get caught off guard when they first try to make a hash whose
> > values are themselves lists. *grin*
> >
> WOW. Great explanation. Don't wor
On Thu, 19 Jan 2006, Jon Moore wrote:
> I need some help for a program I am writing as a newbie to Python.
>
> I have created a series:
>
> WORDS = ("python", "program", "code", "xylophone")
>
> and then assigned one of them randomly to the variable 'word':
>
> word = random.choice(WORDS)
>
> I
On Thu, 19 Jan 2006, John Joseph wrote:
> Hi
>I tried out my first Pyhton program with MySQL
> I was trying to get the some result , eg
> describe table, select * from table
Hi John,
Unlike Java, Python doesn't force you to put everything in a class. You
can try the simpl
On Thu, 19 Jan 2006, Vincent Zee wrote:
> say you want to write a more-like program. How do you know how many
> lines the terminal window can display.
Hi Vincent,
It's possible that this information might already be in your environment.
If you're using the 'bash' shell, and if the 'checkwinsiz
On Fri, 20 Jan 2006, ps python wrote:
> In my XML file some attributes have text within an element. I want to
> get that text. How can I do that.
Hello,
The problems you have don't have to do with the calls to gettext, but to
selecting namespaced nodes as with your previous questions. Let's
On Thu, 19 Jan 2006, Kent Johnson wrote:
> In your original desing were you sharing a connection between threads?
> That could cause trouble. But if each connection has its own thread and
> you are using transactions and isolation levels appropriately, they
> shouldn't stomp on each other.
Hi
On Fri, 20 Jan 2006, Bernard Lebel wrote:
> So have written a little test script. The fact is that I want to be able
> to manage the same queue from separate threads. Below is an example of
> what my real program is doing:
Hi Bernard,
One problem is that there's a single outputQueue being pre
> > I've written a couple of scripts that check log files on our WIndows
> > and Unix servers. These scripts have plain text passwords in them, so
> > anyone who can access the filesystem of the Windows server that runs
> > the scripts can discover the passwords of the servers.
Hello,
I guess o
On Sat, 21 Jan 2006, Todd Maynard wrote:
> I want to thank you for ruining my plans for a relaxing Saturday
> morning. As a thread newbie I killed several hours playing around with
> your code.
Hi Todd,
Sorry about that. I hope you were relaxing in a cafe while playing with
the code.
> One
> Why will this little program crash when you enter the enter key?
[program cut]
Hi Vincent,
What do you mean by "crash"? Do you get an error message? If so, can you
show us?
It will also help to think to try playing the situation out without
preconceptions. In the beginning of the loop, a
> I noticed that when I do a keyboard interrupt, I get the keyboard
> interrupt exception messages, but after that it keeps hangning and never
> returns to the command line input mode. I have to close the shell to
> really end the program afaics.
Hi Bernard,
When we're using the high-level 'thr
On Mon, 23 Jan 2006, Bernard Lebel wrote:
> Yes that makes sense, but.. what is a "daemon"? Sorry if this is
> super basic question.
According to:
http://docs.python.org/lib/thread-objects.html
"""A thread can be flagged as a ``daemon thread''. The significance of
this flag is
Hi Ben,
Jon Libes of the National Institute of Standards and Technology (NIST) has
written a guide on how to handle passwords in backgrounded processes:
http://expect.nist.gov/doc/bgpasswd.pdf
It has more suggestions on how to handle passwords securely. As you might
expect, it doesn't have
On Mon, 23 Jan 2006, Danny Yoo wrote:
> Jon Libes of the National Institute of Standards and Technology (NIST)
^^^
Gaah. I'm sorry, that should be "Don", not "Jon". My muscle memory
slipped. *grin*
___
Tutor mailli
On Tue, 24 Jan 2006, Ivan Furone wrote:
> I'm not sure I understand what you are saying here. Surely if the file
> is compiled it can just run (and will only need to be RE-compiled when I
> have to change the code (such as when one of the servers has their
> password changed).
Hi Ivan,
But the
> I tried :
>
> for line in f:
> gloss[line] = f.readline()
>
This should have worked, but there's one problem. Whenever we're doing
something like:
for line in f:
...
there can be some interference between the iteration and any readline()
in the body of the loop. For eff
> Here's one way we can avoid the problem:
>
> while True:
> word = f.readline()
> defn = f.readline()
> if not word or not defn:
>break
> ...
>
> Does this make sense?
>
> It does mostly...I don't see why you need the:
>
> if not word or not defn:
Hi Jan,
Side question: how much Python do you know already? It really seems like
you've just picked up an introductory example, so I'm not exactly sure I
see where you might be getting stuck or what things you've tried already.
Anyway, when you mention:
> i am trying to send emails through a
On Sun, 29 Jan 2006, John Joseph wrote:
>I am sending the code of the function "searchbyemail" and the output
>of the program when I run I am trying to search and display the
>results , even if we give a part of the email_id
Hi John,
Ok; because the question you're asking looks a l
> the email id which starts with “j” is
> select * from contact where email_id like 'j%';
Hi John,
Ok, looks good so far. So in a Python program, we might try something
like this:
##
## assuming cursor is set u
-- Forwarded message --
Date: Sun, 29 Jan 2006 10:28:09 -0500 (EST)
From: jan.n <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] email-sending..
Hi Danny,
i have crossed that point where it complains of socket error.., but now i am
stuck
On Mon, 30 Jan 2006, Shuying Wang wrote:
> So I've got a class X with instance variables a, b, c. Is there any way
> of creating a dictionary of these instance variables besides the
> no-brainer way of doing dictionary = {'a' : X.a, 'b' : X.b, 'c' : X.c} ?
Hi Shuying,
It's an somewhat low-leve
> Could someone help me understand the output I'm getting from the snippet
> below? I thought I would get a nice row of cards, 13 reds, 13 blues,
> etc. But what I get is a row of all red cards. The rank is correct on
> the cards, but they are all red.
Hi Terry,
There is an issue with the loop
On Mon, 30 Jan 2006, Pat Martin wrote:
> My question is, what next? Is there some intermediate tutorials or books
> out there that I can start learning some real meat in the language?
Hi Pat,
Maybe you'd like something like:
http://diveintopython.org/
which is pretty meaty (or, if you're
On Tue, 31 Jan 2006, Jon Moore wrote:
> I have been looking for contact details for the author to ask him what
> he was eluding to with the exercise, but to no avail.
Hi Jon,
I did find errata here:
http://www.muskalipman.com/ptr_detail.cfm?group=Programming&all=1&isbn=1-59200-073-8
(bottom
> A snippet of the problem is here. The terms in file as
> tab delim manner.
[data cut]
> Now my question is to enrich members that have identical lineage with
> different leaf. 'i.e': a b c d - van suv.
Hi Srinivas,
You're starting to use the vocabulary of tree data structures here. Let's
> I am having some fun with python and making multiple runs on an
> algorhythm and sometimes getting some fun stuff that i would like to be
> able to reproduce, but there are some random elements in it. I wonder is
> there a way to see the random seed, and make note of it so that you
> could then
On Wed, 1 Feb 2006, Srinivas Iyyer wrote:
> I have a file which is 2.5 Gb.,
>
[data cut]
>
> There are many duplicate lines. I wanted to get rid of the duplicates.
Hi Srinivas,
When we deal with such large files, we do have to be careful and aware of
issues like the concept of memory.
> I
On Thu, 2 Feb 2006, kevin parks wrote:
> Danny (hope you are good!) & co,
>
> I see that biz about random.seed()... but in the absence of setting that
> ... does it just grab a value from the system clock?
Yes. Here's what the documentation says officially:
"""current system time is also used
On Thu, 2 Feb 2006, johan nilsson wrote:
> apparently the XP box thinks the file is alot shorter, and that can't be
> as it is the same file from the same media (USB stick). What is going
> wrong here?
Hi Johan,
Is it possible that you need to treat the file as a binary file? It's
rare, but
On Thu, 2 Feb 2006, Michael Haft wrote:
> was just trying to do something and tried the following code:
>
> list = ["1", "test", "1.5"]
>
> for x in list:
> print list.pop(x)
>
> I get the following error:
>
> print list.pop(x)
> TypeError: an integer is required
Hi Michael,
Th
On Fri, 3 Feb 2006, deepak.gupta wrote:
> I did my script like this for backing my max_everest_2006 mysql database
>
> error: 1044: Access denied for user 'MAX_USER'@'%' to database
> 'MAX_EVEREST_2006' when using LOCK TABLES
Your question doesn't have to do with Python. Ask your MySQL
admini
> > But this assignment sort of puzzles me to why it's done like this
> > (maybe cuz I am not used to it and can not see beyond my own
> > experience in coding (having a blind spot or something like that)).
If we have a snippet of code like:
###
def test():
x = []
f(x)
print
On Sun, 5 Feb 2006, Akanksha Govil wrote:
> I am new to python, I want to know how to use a debugger and which
> debugger give a GUI .
Hi Akanksha,
Have you looked at 'pdb' yet?
http://www.python.org/doc/lib/module-pdb.html
Several of the major Python IDEs also provide some kind of debu
On Sun, 5 Feb 2006, linda.s wrote:
> I installed python in both Windows and Mac. I am very curious why the
> installation under Mac take so long time compared to that under
> Windows.
Hi Linda,
But that's somewhat odd, because it should take zero time: Python's
already installed under Mac OS X
> Thanks for your kindness. The version of My Mac is
> Mac OX 10.4.4; I guess that Python 2.3.5 has been installed before.
> Now I tried to install Python 2.4.2;
Hi Linda,
Ah, ok, then the long "installation" time you are seeing is perfectly
normal, and the comparison you're making between the i
>Avoid debuggers like a plague. If someone applies for a job
> with us and starts talking about their proficiency in
> debuggers, the interview stops right there and we keep looking.
Hi Tim,
Seriously? I know that the implication is that sufficient test cases and
design wil
On Tue, 7 Feb 2006, Paul Kraus wrote:
> Anyone know where I can find information about how to embedd mysql into
> a python application. I need my hand held. I have worked with mysql a
> lot. I understand how to use python to manipulate a mysql database. What
> I want to know is how to embedded a
On Tue, 7 Feb 2006, josip wrote:
> I can't solve this, someone please help.
Since this is a homework problem, we're limited in what we can say here.
Can you simplify the problem a bit? Can you write a program that asks for
stars, and just prints out that many stars? That is, ignore for now
> from the docs, the byte stream is supposed to look like this:
>
[problem cut]
>
> so. how do i make 200 occupy 4 bytes ?
Hi Nephish,
Have you had a chance to look at the 'struct' module yet?
http://www.python.org/doc/lib/module-struct.html
__
Hi Chris,
I'm going to be a little insidous and bring some ideas from the textbook
"How to Design Programs." (http://htdp.org)
Let's annotate each interesting method with what the method expects to
take in, and what it expects to return.
> def placeOrder(self, foodName, employee):
We c
On Tue, 7 Feb 2006, Christopher Spears wrote:
> I get it! Have printFood return a string!
>
> def printFood(self):
> return self.food.foodName
Yup. *grin*
Do one more thing though: call the function something other than
'printFood' now, since it clearly isn't doing any printing
On Tue, 7 Feb 2006, guy wrote:
> I am in the QA field, and am learning Java as well in school but must QA
> jobs today require one to know some scripting language. I do know SQL (Using
> MySQL) and have writing small starting python and java scripts like
> calc.py/java and other print statements
On Wed, 8 Feb 2006, Simon Gerber wrote:
> I watch many different TV shows on my PC, as many of us do. But I am
> sick and tired of forgetting which episode I was up to. So, in a
> prodigious effort to avoid ever using, say, a pen, I am working on a
> script to take over some of my brain's memory
On Wed, 8 Feb 2006, le dahut wrote:
> I've Python 2.4.1 installed and 'setup.py' doesn't recognize the
> '--record-rpm' option :
> "error: option --record-rpm not recognized"
>
> The patch including this feature is available since a long time so
> what's happening ?
Hi Le Dahut,
You may be bet
> These sound like homework questions, in which case it would not be right
> for us to just give you the answer (and it would not be right for you to
> ask for it).
Agreed; these are not small questions at all. Natasha, if you're having
trouble, please be more specific about what you're getting
On Wed, 8 Feb 2006, Rich Shepard wrote:
>I'm trying to understand how to write SQL statements using pysqlite.
> The problem is that if I use newlines to format the SQL statements as I
> would with straight SQLite or PostgreSQL, python complains because it
> sees the newline before the end of
> I've got this:
>
> ---
> def isBottomDir(path):
> for item in os.listdir(path):
> if os.path.isdir(os.path.join(path,item)):
> return False
> return True
> ---
>
> Is that an acceptable way of doing this?
Hi Simon,
Your code looks good to me!
> I've been
> I realise teachers have to test mastery of certain techniques, but they
> seem to lack the imagination.
I agree; the problem here, I think, is that these homework questions often
focus WAY too much on Python-specific features, rather than on fundamental
issues, and so the questions end up feel
On Wed, 8 Feb 2006, Victor Bouffier wrote:
> Hi to all,
>
> I'd like to split a long string into equally long strings (len(str) =
> 3). I did the following using regexes:
>
> >>> n = 'xb1jyzqnd1eenkokqnhep6vp692qi9tmag3owzqw0sdq3zjf'
> >>> o = re.split(r'(...)', n)
> >>> print o
> ['', 'xb1', ''
On Thu, 9 Feb 2006, Nicky Ng wrote:
> I would like to implement a breadth first serach with Python and read
> data from a text file with following file format
[cut]
Hi Nicky,
We've seen the problems from Programming Challenges:
http://www.programming-challenges.com/pg.php?page=index
and
[Forwarding the question on breadth first search to tutor]
-- Forwarded message --
Date: Fri, 10 Feb 2006 07:25:05 +0800
From: Nicky Ng <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Breadth first search
Dear Danny,
I did not rea
> I am new in Python so not sure how to do with Python to solve this
> problem.
Hi Nicky,
Would you know how to do this problem in a different programming language?
I'm not getting any sense at all at what experience or level you have.
The question is just hard enough that asking it to a total
> I'd like to do the following
> while(1):
> try:
> reader.next() ## csv object method
> except cvs._csv.Error: ## or something like this
> print "bad csv record, skipping "
> continue
> except StopIteration:
> break
>
> The problem is that python do
> for root, dirs, files in os.walk(top):
> for name in dirs:
> print name
> for name in files:
This code looks suspicious. At this point, when we say "name", what do we
expect to get here? Do you mean the directory name, or the file name?
It can't be both!
On Tue, 14 Feb 2006, Paul Kraus wrote:
> Everything configures fine but when I build it dies here...
> (If this is not the right place for this please point me to where I should be
> posting.)
Hi Paul,
Try the comp.lang.python newsgroup; this installation question seems very
specialized, and
801 - 900 of 2125 matches
Mail list logo