Welcome, Guest
Python Scripts for ComicRack

TOPIC: Python Help: Splitting notes by line

Python Help: Splitting notes by line 6 years 11 months ago #10750

Ok, I've tried everything I can find and I'm still getting odd results. I'm writing a script to embed a tag-like string into the notes that can store some info. I'm intending to make sure it's always on it's own line, so I'm going to pull in the notes and split them into a list with each seperate line as it's own element. However, I'm not able to find a way that doesn't split each and every character into it's own element. So the code:

lines=book.Notes.split("\n")
for line in lines:
print line

when the notes start with "Scraped metadata from" etc. returns:
S
c
r
a
p
e
d
etc.

I've tried using "\r" and the splitlines() function but no good. Anyone have any ideas?
The administrator has disabled public write access.

Re: Python Help: Splitting notes by line 6 years 11 months ago #10752

  • cbanack
  • cbanack's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1318
  • Thank you received: 503
  • Karma: 181
I'm not sure why that doesn't work for you, it seems to work ok for me.
Have you tried:
print book.Notes

just to be sure that there aren't some html-invisible linebreaks in there?

Also, try:
lines=book.Notes.split("$")
for line in lines:
   print line
Last Edit: 6 years 11 months ago by cbanack.
The administrator has disabled public write access.
Time to create page: 0.146 seconds

Who's Online

We have 192 guests and 4 members online