I have an MySQL database called zingers. The structure is:
zid - integer, key, autoincrement
keyword - varchar
citation - text
quotation - text
I am having trouble storing text, as typed in latter two fields.
Special characters and punctuation all seem not to be stored and
retrieved correctly.
S
I have an MySQL database called zingers. The structure is:
zid - integer, key, autoincrement
keyword - varchar
citation - text
quotation - text
I am having trouble storing text, as typed in latter two fields.
Special characters and punctuation all seem not to be stored and
retrieved correctly.
S
> >
> Try putting "use_unicode=True" in the MySQLdb "connect" call.
tried that, and also added charset="utf8" -
now, I can't do any string operations, I get the error msg:
descriptor 'lower' requires a 'str' object but received a 'unicode'
args = ("descriptor 'lower' requires a 'str'
version of python is either 2.2 or 2.4
bests,
-rsr-
John Nagle wrote:
> ronrsr wrote:
--
http://mail.python.org/mailman/listinfo/python-list
version of python is 2.2 -
--
http://mail.python.org/mailman/listinfo/python-list
>
> are you passing in the strings as Unicode strings, or as something else?
> if you're using something else, what have you done to tell the
> database what it is?
>
not at all sure what I'm passing it as.
The database default encoding is utf-8
the database collation is utf-8
the page encod
structure for the DB:
CREATE TABLE `zingers` (
`zid` int(9) unsigned NOT NULL auto_increment,
`keywords` varchar(255) default NULL,
`citation` text,
`quotation` text,
PRIMARY KEY (`zid`)
) ENGINE=MyISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=422 ;
code for stor
I have an MySQL database called zingers. The structure is:
zid - integer, key, autoincrement
keyword - varchar
citation - text
quotation - text
the encoding and collation is utf-8
I am having trouble storing text, as typed in last two fields. Special
characters and punctuation
, but have had no luck doing that - I thought split wuld do that,
but it doens't.
bests,
-rsr-
Robert Kern wrote:
> ronrsr wrote:
> > I have a single long string - I'd like to split it into a list of
> > unique keywords. Sadly, the database wasn't designed to d
I have a single long string - I'd like to split it into a list of
unique keywords. Sadly, the database wasn't designed to do this, so I
must do this in Python - I'm having some trouble using the .split()
function, it doesn't seem to do what I want it to - any ideas?
thanks very much for your help.
I have a single long string - I'd like to split it into a list of
unique keywords. Sadly, the database wasn't designed to do this, so I
must do this in Python - I'm having some trouble using the .split()
function, it doesn't seem to do what I want it to - any ideas?
thanks very much for your help.
Thank you, all. that was very helpful, and did solve many of my
problems. I was addressing the dict with () rather than [].
I'm still having one problem, though -- extracting the keywords. NOw,
if you check the value for Form below, you'll see there is more than
one keyword entry. When I do: k
Thank you, all. that was very helpful, and did solve many of my
problems. I was addressing the dict with () rather than [].
I'm still having one problem, though -- extracting the keywords. NOw,
if you check the value for Form below, you'll see there is more than
one keyword entry. When I do: k
I'm having trouble extracting cgi parameters in my code - this is a web
application, so I only know the line that's causing the problem.
here's the info I know:
form = FieldStorage(None, None, [MiniFieldStorage('zid', '17'),
MiniFieldStorage('keywords', 'aAUA'), MiniFieldStorage('keywords',
'aBOS
I'm trying to break up the result tuple into keyword phrases. The
keyword phrases are separated by a ; -- the split function is not
working the way I believe it should be. Can anyone see what I"m doing
wrong?
bests,
-rsr-
print "newstring =", str(result[i][0])
print "just split", st
How do I tell
how many strings, or how many bytes are in each dimension? so that I
can iterate through them.
Each entry in that list is a keyword - Alternately, is there any fast
way to parse that into a sorted list of distinct keywords.
very sorry for the error.
bests,
-rsr-
Fredrik Lundh
it looks like the len() function is the one I want.
for: len(result) - i get 248,
but for len(result[0]) or len(result[1]) i always get 0.
ronrsr wrote:
> here is my result.
> How do I determine the number of tuples in this array, returned from a
> mysql database?
>
> How do
here is my result.
How do I determine the number of tuples in this array, returned from a
mysql database?
How do I determine the number of characters or entry in each tuple?
thanks very much for your assistance,
-rsr-
(('Agricultural subsidies; Foreign aid',), ('Agriculture; Sustainable
Agricu
I just changed the database to be a TEXT field, and that took care of
the array() stuff - Now, I'm trying to convert the formatting codes to
html.
thanks for your help.
bests,
r0sr-
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 13, 2:48 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> ronrsr wrote:
> > when I try to print a web table containing output from a database, I am
> > getting more info than I want- -
>
> > I would like this to print w'o the array('c',arrays in
when I try to print a web table containing output from a database, I am
getting more info than I want- -
I would like this to print w'o the array('c',AND I'd like the
control characters to print as HTML control chars.
array('c', '- "In the boom years of 1990-1997 developing countries paid
mor
I think I am passing the wrong argument to the Print_row routine:
Traceback (most recent call last):
File "index.py", line 91, in ?
zhtml.print_row(record)
File "/usr/www/users/homebase/realprogress/zingers/zhtml.py", line
154, in pri
nt_row
print """
TypeError: format requires a map
what is python trying to tell me here? does it have to do with
formatting the string.
Keywords and Zinger are fields in my database.
print """
Keywords
Zinger
TypeError: format requires a mapping
thanks much in advance,
-rsr-
--
http://mail.python.org/mailman/listinfo/pytho
the syntax error comes in the main program, in any line that follows
the import statement.
ronrsr wrote:
> the exact code that is triggering the error message is:
>
> zc = zsql.connect()
>
>
> exact error message: SyntaxError: Invalid Syntax
>
>
> but any statem
the exact code that is triggering the error message is:
zc = zsql.connect()
exact error message: SyntaxError: Invalid Syntax
but any statement that follows the import statement will trigger it.
bests,
r-sr-
Roberto Bonvallet wrote:
> ronrsr wrote:
> > thanks for the spee
);
but even when I have that, I still get the same error.
bests,
-rsr-
ronrsr wrote:
> here's some of t
--
http://mail.python.org/mailman/listinfo/python-list
here's some of the surrounding code from the main program:
querystring = querystring + " ORDER BY keywords ";
#SQL
import zsql
zc = zsql.connect()
print("return from open")
zq = zc.query(querystring).dictresult()
ronrsr wrote:
> no matter where I place this
no matter where I place this imported file,the statement after it in
the main program gets a syntax error, regardless of the syntax.
I think I may have changed something in this file, but I'm stuck. Can
anyone help?
#!/usr/local/bin/python
# Copyright 2004 by Stephen Masterman
#Change the db co
28 matches
Mail list logo