"Alan Gauld" <[EMAIL PROTECTED]> wrote
> "Malcolm Greene" <[EMAIL PROTECTED]> wrote in message
Oops, sorry. I hit the send button by mistake while aiming
for the File menu!
>> Any suggestions for how to normalize and compress whitespace in a
>> string?
>> I know I can use regular expressions
"Malcolm Greene" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Any suggestions for how to normalize and compress whitespace in a
> string?
>
> By normalize I mean convert tabs and soft spaces (extended ascii
> code
> 160) to spaces.
>
> By compress I mean replace all runs of 2 or
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
> As Python/pysqlite stores the items in the db.table as unicode
> strings, I've also run the code with q=u"dog" but get the same
> error. Same with putting the q as a tuple ie. (q) in the Select
(q) is not a tuple, it is a variable surrounded by qu
Dinesh B Vadhia wrote:
> I belong to the Old School where getting my head around OO is just one
> big pain.
> I write software by modularization executed as a set of
> functions - and it works (some call this functional programming!).
Some are wrong. That style of programming is correctly cal
Dinesh B Vadhia wrote:
> I belong to the Old School where getting my head around OO is just one big
> pain.
> I write software by modularization executed as a set of functions -
> and it works
The great thing about Python is that you can use Classes if you want,
or not if you don't. I use them
Dinesh B Vadhia wrote:
> I belong to the Old School where getting my head around OO is just one
> big pain. I write software by modularization executed as a set of
> functions - and it works (some call this functional programming!).
> Whenever I review Python books (eg. Lutz's excellent Progra
I belong to the Old School where getting my head around OO is just one big
pain. I write software by modularization executed as a set of functions - and
it works (some call this functional programming!). Whenever I review Python
books (eg. Lutz's excellent Programming Python, 3ed) the code is
Malcolm Greene wrote:
> Any suggestions for how to normalize and compress whitespace in a
> string?
>
> By normalize I mean convert tabs and soft spaces (extended ascii code
> 160) to spaces.
>
> By compress I mean replace all runs of 2 or more spaces (after the
> normalization step) to a single
Any suggestions for how to normalize and compress whitespace in a
string?
By normalize I mean convert tabs and soft spaces (extended ascii code
160) to spaces.
By compress I mean replace all runs of 2 or more spaces (after the
normalization step) to a single space.
I know I can use regular expre
linuxian iandsd wrote:
> well, i can assure you i am not. simply because i have a
> username/password for this site, plus, I have thier agreement to
> automate the process of utilizing thier database all i want from
> midnight to 6 am.
Perhaps the supplier would give you an interface that does
Dinesh B Vadhia wrote:
> Okay, I've got this now:
>
>> con = sqlite3.connect(":memory:")
>> cur = con.cursor()
>> cur.execute("""CREATE TABLE db.table(col.a integer, col.b text)""")
>> con.executemany("""INSERT INTO db.table(col.a, col.b) VALUES (?, ?)""", m)
>> con.commit()
>
>> for row in con.e
i see no body has replied to my question,
probably you are thinking this guy is hijicking someones website ?
well, i can assure you i am not. simply because i have a username/password
for this site, plus, I have thier agreement to automate the process of
utilizing thier database all i want from mi
Okay, I've got this now:
> con = sqlite3.connect(":memory:")
> cur = con.cursor()
> cur.execute("""CREATE TABLE db.table(col.a integer, col.b text)""")
> con.executemany("""INSERT INTO db.table(col.a, col.b) VALUES (?, ?)""", m)
> con.commit()
> for row in con.execute("""SELECT col.a, col.b FROM
Simone wrote:
> In Python the symbol '%' in a string is a special char: you use it, for
> instance, to place a variable inside a string.
For completeness, it's worth mentioning in passing that % is only
special when you're doing string formatting. It's not otherwise
special in strings.
> Howeve
i forgot to mention that you need to try your sql commands out of your
script before trying them inside,
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I m not sure this is your case but i believe you are missing the
"cur.fetchall()" command which does fetch data from sql db
i suggest you put a print statement for every data you use in your program
that way you know whats empty & whats not...
here is example of MySQLdb process:
con=MySQLdb.c
Dinesh B Vadhia ha scritto:
> The second problem is that I'm using the LIKE operator to match a
> pattern against a string but am getting garbage results. For example,
> looking for the characters q='dog' in each string the SELECT statement
> is as follows:
>
> for row in con.execute("SELECT
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
> I'm using the LIKE operator to match a pattern against a string
> using this SELECT statement:
>
> for row in con.execute("
> SELECT
> FROM
> WHERE LIKE '%q%'
> limit 25"):
> With q="dog" as a test example, I've tried '$q%', '%q%', '%q'
Ok,
Try again:
I'm using the LIKE operator to match a pattern against a string using this
SELECT statement:
for row in con.execute("SELECT FROM WHERE LIKE '%q%'
limit 25"):
.. where , , are placeholders!
With q="dog" as a test example, I've tried '$q%', '%q%', '%q' and 'q%' and none
of the
19 matches
Mail list logo