For anyone who was following this, here is the finished, non floating
point, program, after all the kind advice received has been incorporated
into it (hopefully I have the leap year logic right...):
# *** (7) MAIN BODY -- The Buck Starts Here! ***
def isLeapYear(y):
if y % 4 == 0
On Tue, 3 Jul 2007, Jon Crump wrote:
> but where there are diacritics involved, title() gives me:
>
> AngoulMe, Angoumois.
>
> Can anyone give the clueless a clue on how to manage such unicode strings
> more effectively?
I think setting the locale is the trick:
>>> s1 = open("text.txt").readlin
On Tue, 3 Jul 2007, William O'Higgins Witteman wrote:
> Has anyone found a silver bullet for ensuring that all the filenames
> encountered by os.walk are treated as UTF-8? Thanks.
What happens if you specify the starting directory as a Unicode string,
rather than an ascii string, e.g., if you'r
Dear All,
I have some utf-8 unicode text with lines like this:
ANVERS-LE-HOMONT, Maine.
ANGOULÊME, Angoumois.
ANDELY (le Petit), Normandie.
which I'm using as-is in this line of code:
place.append(line.strip())
What I would prefer would be something like this:
place.append(line.title().strip
"Kent Johnson" <[EMAIL PROTECTED]> wrote
>> I suspect you need to set the Locale at the top of your file.
>
> Do you mean the
> # -*- coding: -*-
> comment? That only affects the encoding of the source file itself.
No, I meant the Locale but I got it mixed up with the encoding
in how it is set
"Terry" <[EMAIL PROTECTED]> wrote
> Wow! Those changes radically change the program!
>
> Is there a way to get the try-exception to cause the
> end user questions to be repeated until acceptable
> answers are given?
Put the whole blocxk inside a while loop:
start = end = None
while start
Alan,
Wow! Those changes radically change the program!
Is there a way to get the try-exception to cause the end user questions
to be repeated until acceptable answers are given? Like a kind of
"return"
or "repeat" command that could be added to the except side of things?
try:
start = int(
William O'Higgins Witteman wrote:
> I have several programs which traverse a Windows filesystem with French
> characters in the filenames.
>
> I have having trouble dealing with these filenames when outputting these
> paths to an XML file - I get UnicodeDecodeError: 'ascii' codec can't
> decode by
Alan Gauld wrote:
> "William O'Higgins Witteman" <[EMAIL PROTECTED]> wrote
>
>> I have several programs which traverse a Windows filesystem with
>> French
>> characters in the filenames.
>
> I suspect you need to set the Locale at the top of your file.
Do you mean the
# -*- coding: -*-
comment
Picio wrote:
> Hello all, I need some advice to choose an xml generator for jsviz a
> tool in javascript to create some wonderful graphs (SnowFlake or Force
> directed).
>
> Starting from a SQL table (mysql) I need to create a XML file with a
> structure like this:
>
>
>
>
>
"Terry" <[EMAIL PROTECTED]> wrote
> I was using the "t1 == int(t1)" type compare, that I
> learned in BASIC about 25 years ago, to discover
> a remainder or no.
What a pity. Even the most elementary BASIC has
always had the MOD operator for finding remainders.
and a \ operator for integer d
"William O'Higgins Witteman" <[EMAIL PROTECTED]> wrote
>I have several programs which traverse a Windows filesystem with
>French
> characters in the filenames.
I suspect you need to set the Locale at the top of your file.
Do a search for locale in this lists archive where we had a
thread on th
"Picio" <[EMAIL PROTECTED]> wrote
> I know there are a lot of good tools to do this in pyhton
Yep, you could use minidom and I think ElementTree can write
XML as well as read it.
> flexibility for the future I'd like to use an Object relational
> mapper
> like SQLAlchemy or SQLObject todo the
"Terry" <[EMAIL PROTECTED]> wrote
> trapping for possible user errors.
> I am using x.isalnum() to check that I have a number
First, alnum() checks for alpha-numeric characters so
will allow both alphabetic characters and numerics.
BUT in python its better to ask forgiveness that permission
so
"Carroll, Barry" <[EMAIL PROTECTED]> wrote
> If you have trouble coming up with an idea for a project, check
> python.org for existing projects in need of help
Or even try sourceforge.net.
You can search for OpenSource projects that need help and
filter by language.
Or try UselessPython for
Hi Bhaaluu,
I have misled you. I am working on a section ABOVE the program I showed,
that I am thinking to
have my most used elements in, left in a state of being # remarks. In
other words, I am thinking
of creating a set of most used CONVENTIONS and leave them as a blank
file. Thus, when I need
Ha Ha Ha It appears I was having a very blond day.
For some reason, I was mentally verbalizing to myself, each time I
looked at x.isalnum(), "X IS-ALL-NUMBERS",
instead of "X IS-Alpha-Numeric". I remember thinking..if one can
call it that., "I wonder why x.isdigit()
is singular for o
Ark wrote:
> Hi!
> First, my english may be bad, so I apoligize.
> This is the first time i mail the list and it's about something i've
> been investigating, but i haven't found enough information.
> I want to learn how to do extensible aplications using plugins. I've
> found some how tos an tut
* Ark <[EMAIL PROTECTED]> [2007-07-03 11:50]:
> Hi!
> First, my english may be bad, so I apoligize.
> This is the first time i mail the list and it's about something i've been
> investigating, but i haven't found enough information.
> I want to learn how to do extensible aplications using plugins.
> -Original Message-
> Message: 7
> Date: Tue, 3 Jul 2007 19:46:42 +1200
> From: Ben Walden <[EMAIL PROTECTED]>
> Subject: [Tutor] how long?
> To:
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> How long will it take until I successfully create my ow
Hi!
First, my english may be bad, so I apoligize.
This is the first time i mail the list and it's about something i've been
investigating, but i haven't found enough information.
I want to learn how to do extensible aplications using plugins. I've found
some how tos an tutorials, but they're not
I have several programs which traverse a Windows filesystem with French
characters in the filenames.
I have having trouble dealing with these filenames when outputting these
paths to an XML file - I get UnicodeDecodeError: 'ascii' codec can't
decode byte 0xe9 ... etc. That happens when I try to c
On 7/3/07, Ben Waldin <[EMAIL PROTECTED]> wrote:
How long will it take until I successfully create my own working program
that is useful? I have crated the address book ones in the tutors and just
want to know how long it takes before I start to create my own thought up
programs that will be use
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ben Waldin
> Sent: Tuesday, July 03, 2007 1:47 AM
> To: tutor@python.org
> Subject: [Tutor] how long?
>
> How long will it take until I successfully create my own
> working program that is useful?
Hello all, I need some advice to choose an xml generator for jsviz a
tool in javascript to create some wonderful graphs (SnowFlake or Force
directed).
Starting from a SQL table (mysql) I need to create a XML file with a
structure like this:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Consider using something like:
try:
start, end = int(start), int(end)
except ValueError:
print "oops it was not a number."
Andreas
Terry wrote:
> Hi!
>
> I am running Python 2.5, and I have an IF statement in the below program
> that does n
* Ben Waldin (Tue, 3 Jul 2007 19:46:42 +1200)
> How long will it take until I successfully create my own working program that
> is useful? I have crated the address book ones in the tutors and just want to
> know how long it takes before I start to create my own thought up programs
> that will b
Terry wrote:
> Hi!
>
Hi...
> I am using x.isalnum() to check that I have a number for each year
> entered, and it doesn't look to me like it is functioning properly.
That's because "x.isalnum()" will return True if "x" is not empty and
it's content are *either* an Alpha or a Number (which
Greetings,
Perhaps the first thing you should do, before checking
whether the user entered '' instead of '2000' is to
get the leap year function working properly.
Definition:
Leap years occur according to the following formula:
a leap year is divisible by four,
but not by one hu
Use isdigit instead of isalnum.
HTH,
Wolfram
On 03.07.2007 09:51, Terry wrote:
> Hi!
>
> I am running Python 2.5, and I have an IF statement in the below program
> that does not seem
> to be doing it's job. The program simply acquires a range of years from
> the user and prints out
> all the lea
Hi!
I am running Python 2.5, and I have an IF statement in the below program
that does not seem
to be doing it's job. The program simply acquires a range of years from
the user and prints out
all the leap years between the two dates. I am having trouble in
trapping for possible user
errors. I a
How long will it take until I successfully create my own working program that
is useful? I have crated the address book ones in the tutors and just want to
know how long it takes before I start to create my own thought up programs that
will be useful. Thanks Ben
__
"Tiger12506" <[EMAIL PROTECTED]> wrote
> The cleanup temp files is more difficult. It depends on how much you
> want to
> do. Usually it is sufficient to delete the contents of the
> windows/temp
> folder. This will delete cookies, temporary files, internet temp
> files that
> are commonly cle
33 matches
Mail list logo