Hi,
I have some simple code - which works...kind of..here's the code:
[code]
import os
def print_tree(start_dir):
for f in os.listdir(start_dir):
fp = os.path.join(start_dir, f)
print fp
if os.path.isfile(fp): # will return false if use f here!
if os.path.
dutche wrote:
> Now, that I know a bit of Python, I want to make some simple project, I
> thought something like a menu, just like "kxdocks" menu or something
> like that, with transparency and all with xml. But I dont know what
> things I have to know.
>
Start with some simple non-gui apps firs
Ah of course, isfile(f) can only return true if it can find f! :)
I'm going to investigate those other functions too :)
Thanks a lot guys!
Tony
--
http://mail.python.org/mailman/listinfo/python-list
George Sakkis wrote:
> By the way, an easier way to deal with paths is the path.py module
> (http://www.jorendorff.com/articles/python/path/). Your example could
> be rewritten simply as:
>
> from path import path
> for html_file in path(start_dir).walkfiles('*.html'):
> print 'html file found
Hi,
I am trying to get a regexp to validate email addresses but can't get
it quite right. The problem is I can't quite find the regexp to deal
with ignoring the case [EMAIL PROTECTED], which is not valid. Here's
my attempt, neither of my regexps work quite how I want:
[code]
import os
import re
Hi,
thanks for the advice guys.
Well took the kids swimming, watched some TV, read your hints and
within a few minutes had this:
r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+')
This works for me. That is if you have an invalid email such as
tony..bATblah.com it will reject it (note the double do
Yes, I didn't make it clear in my original post - the purpose of the
code was to learn something about regexps (I only started coding Python
last week). In terms of learning "a little more" the example was
successful. However, creating a full email validator is way beyond me -
the rules are far too
Might be handy to point out that the Python version will be easier (and
therefore cheaper) to maintain compared to the Perl version. As someone
said there are numerous success stories at python.org.
You could also point him at :
http://www.tiobe.com/tpci.htm
Although Perl is higher than Python (
I thought the 'is' operator was used to identify identical objects,
whereas the '==' operator checked equality. Well, I got a surprise
here:
IDLE 1.1.3
>>> a = 10
>>> b = a
>>> a is b
True
>>> a == b
True
>>> c = 10
>>> a == c
True
>>> a is c
True
>>>
I was NOT expecting the last statement to ret
Dennis Lee Bieber wrote:
> Unfortunately, if management goes further down the page, they find
> Ruby and "D" (when did that get out) both rated so many up arrows they
> had to use shorthand notation to represent 14 arrows...
Yes, there is no doubt Ruby is gaining traction - mostly due to t
Haha!
OK thanks guys.
I was just trying to check if objects were the same (object), didn't
know Integers were a special case.
Thanks,
Tony
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I'm using the isinstance built-in function. I've found the docs for it,
but there are no docs on the supported types.
For example isinstance(a, int) works fine but isinstance(s, string)
doesn't - because 'string is not known'.
I do know how to import the types module and then use defined typ
Thanks for that Fredrik, that's clear. That's actually a pretty nice
feature as it's nicely optimised.
>>> a = 10
>>> c = 10
>>> a is c
True
>>> c = c +1
>>> a is c
False
>>>
Cheers,
Tony
--
http://mail.python.org/mailman/listinfo/python-list
OK Simon, thanks for that link, I think I can ferret out the common
types from there.
Tony
--
http://mail.python.org/mailman/listinfo/python-list
> for dense guys like myself, regular expressions work best if you use
> them as simple tokenizers, and they suck pretty badly if you're trying
> to use them as parsers.
:) Well, I'm with you on that one Fredrik! :)
--
http://mail.python.org/mailman/listinfo/python-list
> I still don't touch regular expressions... They may be fast, but to
> me they are just as much line noise as PERL... I can usually code a
> partial "parser" faster than try to figure out an RE.
Yes, it seems to me that REs are a bit "hit and miss" - the only way to
tell if you've got a RE "righ
Mike C. Fletcher wrote:
> Job security and easy availability is not the be-all and end-all of
> happiness in life. That said, if you know anyone who "just wants a
> job", please, push them at Java, someone has to spend the next 30
> years maintaining the Struts and J*EE sites peop
17 matches
Mail list logo