Re: print function in python3.1

2009-11-23 Thread Terry Reedy
Dennis Lee Bieber wrote: Does Python 3.x include SQLite? Of course ;-] >>> import sqlite3 >>> dir(sqlite3) ['Binary', 'Cache', 'Connection', 'Cursor', 'DataError', [snip] adapt', 'adapters', 'apilevel', 'complete_statement', 'connect', 'converters', 'datetime', 'dbapi2', 'enable_callback_tr

Re: print function in python3.1

2009-11-23 Thread Diez B. Roggisch
Anjanesh Lekshminarayanan wrote: >> Maybe it would help if you explained what you are actually trying to >> accomplish. > > import csv > f = csv.reader(open('data.txt'), delimiter='\t') # 2GB text file > sql = "INSERT INTO `data` VALUES (NULL,%s,%s,%s,%s,%s);" > for row in f: > print (sql, (r

Re: print function in python3.1

2009-11-23 Thread Anjanesh Lekshminarayanan
> Maybe it would help if you explained what you are actually trying to > accomplish. import csv f = csv.reader(open('data.txt'), delimiter='\t') # 2GB text file sql = "INSERT INTO `data` VALUES (NULL,%s,%s,%s,%s,%s);" for row in f: print (sql, (row[0],row[1],row[2],row[3],row[4])) $ python3 p

Re: print function in python3.1

2009-11-23 Thread Carsten Haese
Anjanesh Lekshminarayanan wrote: > As of now, there is no mysql adaptor for Python3. Hence cant use > escape_string() Maybe it would help if you explained what you are actually trying to accomplish. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/p

Re: print function in python3.1

2009-11-23 Thread Anjanesh Lekshminarayanan
As of now, there is no mysql adaptor for Python3. Hence cant use escape_string() > I don't have the slightest clue what you want to say with that. -- Anjanesh Lekshmnarayanan -- http://mail.python.org/mailman/listinfo/python-list

Re: print function in python3.1

2009-11-23 Thread Diez B. Roggisch
Anjanesh Lekshminarayanan wrote: >> Depending on your DB-adapter, you are out of luck here. Either connect to >> a db even if you don't need it, or try & see if you can locate the >> implementation in the module somehow. > > ImportError: No module named MySQLdb > MySQLdb only available in Python2

Re: print function in python3.1

2009-11-23 Thread Anjanesh Lekshminarayanan
> Depending on your DB-adapter, you are out of luck here. Either connect to a > db even if you don't need it, or try & see if you can locate the > implementation in the module somehow. ImportError: No module named MySQLdb MySQLdb only available in Python2. -- Anjanesh Lekshmnarayanan -- http:

Re: print function in python3.1

2009-11-23 Thread Diez B. Roggisch
Anjanesh Lekshminarayanan wrote: > Python 3.1.1 > > sql = "INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s');" > for row in fp: > print (sql, (row[0],row[1],row[2],row[3],row[4])) > . > INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s'); ('142', > 'abc', '2006-04-09 02:

print function in python3.1

2009-11-23 Thread Anjanesh Lekshminarayanan
Python 3.1.1 sql = "INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s');" for row in fp: print (sql, (row[0],row[1],row[2],row[3],row[4])) . INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s'); ('142', 'abc', '2006-04-09 02:19:24', '', '') . Why is it showing %s in the outp