Slocan
|
2010-12-26
, 20:23
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#471
|
|
2010-12-27
, 01:04
|
Posts: 4,556 |
Thanked: 1,624 times |
Joined on Dec 2007
|
#472
|
Something like this should do it (once again, not really tested):
Code:import sqlite3 from xml.sax.saxutils import escape db=sqlite3.connect("/home/user/.feedingit/ArchivedArticles.d/ArchivedArticles.db") links=db.execute("SELECT title,link FROM feed;").fetchall() import sqlite3 from xml.sax.saxutils import escape db=sqlite3.connect("/home/user/.feedingit.0.8.0-4.bkp/ArchivedArticles.d/ArchivedArticles.db") links=db.execute("SELECT title,link FROM feed;").fetchall() file=open("/home/user/MyDocs/Links.txt") for (title,link) in links: file.write(escape(title) + " " + link) file.close()
Traceback (most recent call last):
File "FeedingExport.py", line 7, in <module>
db=sqlite3.connect("/home/user/.feedingit.0.8.0-4.bkp/ArchivedArticles.d/ArchivedArticles.db")
sqlite3.OperationalError: unable to open database file
Traceback (most recent call last):
File "FeedingExport.py", line 7, in <module>
file.write(escape(title) + " " + link)
IOError: [Errno 9] Bad file descriptor
Traceback (most recent call last):
File "FeedingExport.py", line 11, in <module>
file.write(escape(title) + " " + link)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 38: ordinal not in range(128)
The Following User Says Thank You to Laughing Man For This Useful Post: | ||
|
2010-12-28
, 05:57
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#473
|
import sqlite3 import codecs from xml.sax.saxutils import escape db=sqlite3.connect("/home/user/.feedingit/ArchivedArticles.d/ArchivedArticles.db") links=db.execute("SELECT title,link FROM feed;").fetchall() file=codecs.open("/home/user/MyDocs/Links.txt","w","utf-8") for (title,link) in links: file.write("%s %s\n" %(escape(title),link)) file.close()
The Following User Says Thank You to Slocan For This Useful Post: | ||
|
2011-01-17
, 07:38
|
Posts: 5 |
Thanked: 3 times |
Joined on Dec 2010
|
#474
|
|
2011-01-17
, 19:26
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#475
|
|
2011-05-05
, 18:10
|
Posts: 50 |
Thanked: 14 times |
Joined on Mar 2011
|
#476
|
|
2011-05-05
, 18:31
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#477
|
|
2011-06-06
, 01:11
|
Posts: 5,795 |
Thanked: 3,151 times |
Joined on Feb 2007
@ Agoura Hills Calif
|
#479
|
|
2011-06-06
, 02:50
|
Posts: 324 |
Thanked: 371 times |
Joined on Dec 2009
@ Vancouver, BC
|
#480
|