FAQ
NAME:
PySQLite - Extension module for SQLite databases.

DESCRIPTION:
A Python-DB API 2.0 compliant extension module that uses the SQLite
embedded SQL database. No external SQL server required. Think of
Gadfly, only faster.

SQLite is a powerful, embedded relational database in a compact C
library. It supports a large subset of SQL92, multiple tables and
indices, transactions, and triggers. Sources are uncopyrighted and
can be used for any purpose. More information can be found at
<http://www.hwaci.com/sw/sqlite/index.html>.

HOMEPAGE:
<http://pysqlite.sourceforge.net>

DOWNLOAD:
Source and Windows binary downloads are available at
<http://www.sourceforge.net/projects/pysqlite>

AUTHORS:
Gerhard H?ring <gerhard.haering at gmx.de>
Michael Owens <mike at mikesclutter.com>

LICENSE:
Python

NOTES:
The following are changes and enhancements since the last release:

* Make the test suite less noisy. If you want to enable tracebacks of
user-defined functions or aggregates, you'll now have to enable them via
_sqlite.enable_userfunction_debugging. This closes bug reports #608421 and
#608426.

* Fixed lots of bugs in PgResultSet. Access of columns is now
case-insensitive.

* Added test suite for PgResultSet class.



From "gkrohnXvolucris.8m.com".replace Thu Oct 10 09:18:37 2002
From: "gkrohnXvolucris.8m.com".replace (Greg Krohn ("X", "@"))
Date: Thu, 10 Oct 2002 02:18:37 -0500
Subject: [Newbie] Need help with quick text proggy.
References: <24d8090a.0210091854.725f4c9f@posting.google.com>
Message-ID: <ao39el02bel@enews1.newsguy.com>

"Corey Woodworth" <schitz0boy at hotmail.com> wrote in message
news:24d8090a.0210091854.725f4c9f at posting.google.com...
I havn't programmed in python in a while (not since 2.0) but I just
found myself in a predicament where I really need to write a program
and write it fast. Python still seems to be the best choice even
though I'm very rusty and wasn't to good to start with. Here is my
problem. I've got a text file that is a list of elements. a time
followed by a number on each line. Like this for example:

1:46p 65
5:45a 99
2:36p 88
10:53a 79
5:10a 86
2:43p 169
10:14a 55

I just found out that all my times are 6 hours off. (AARGH!) and I
need some help writing a program that will update all those timestamps
for me. Any help at all is appreciated, wheter it be links, some
source, or whatever. Thank a bunch.

Corey
How's this:

fin = file('your/file', 'r')
fout = file('your/other/file', 'w')

for line in fin:
try:
colon = line.find(':')
hour = int(line[:colon])
except ValueError:
print 'Invalid hour: %s' % line
continue

try:
space = line.find(' ')
minute = int(line[colon + 1: space - 1])
except ValueError:
print 'Invalid minute: %s' % line
continue

ampm = line[space - 1: space]
if ampm == 'p':
hour += 12
elif ampm != 'a':
print 'Invalid am/pm indentifier: %s' % line
continue

value = line[space + 1:]

hour += 6
hour = hour % 24

if hour > 12:
hour -= 12
ampm = 'p'
else:
ampm = 'a'

fout.write('%d:%d%s %s' % (hour, minute, ampm, value))

fin.close()
fout.close()


greg

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedOct 10, '02 at 7:30a
activeOct 10, '02 at 7:30a
posts1
users1
websitepython.org

1 user in discussion

Gerhard Häring: 1 post

People

Translate

site design / logo © 2022 Grokbase