[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

python splitting a string

I am trying to split a string.  Consider the following:

>>> import pgdb
>>> db=pgdb.connect(user="reports",password="",database="fsn")
>>> cursor=db.cursor()
>>> cursor.execute("""select referencenames from gnr where lastname='Allison'""",())
>>> row=cursor.fetchone()
>>> print row
['Marshall Partington, friend \r\nAllyce Povick friend ']
>>> list=row[0].split(r"\n")
>>> print list
['Marshall Partington, friend \r\nAllyce Povick friend ']
>>>                                   

I think the last line should be a two element list split on \n.  What am I doing wrong?
0
astar666
Asked:
astar666
1 Solution
 
ramromconsultant Commented:
list=row[0].split("\n")
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now