Python Forum
Python file parsing, can't catch strings in new line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python file parsing, can't catch strings in new line
#2
if ", by" in words or words.startswtih("by"): 
will find that one exeception but that gives you the author only and so you will have to back up one record if you want the title. Note that you lose your rstrip because on the next line your lstrip overwrites the variable returned by rstrip. Just use strip() instead of the 2 statements.
Reply


Messages In This Thread
RE: Python file parsing, can't catch strings in new line - by woooee - Apr-28-2018, 03:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Regex to catch what user has put in text box robertkwild 26 5,713 Jun-26-2024, 01:06 PM
Last Post: AdamHensley
  Reading an ASCII text file and parsing data... oradba4u 2 1,566 Jun-08-2024, 12:41 AM
Last Post: oradba4u
  Can you explain the strings in Python ebn852_pan 3 1,261 May-19-2024, 08:36 AM
Last Post: Pedroski55
  Trying to understand strings and lists of strings Konstantin23 2 1,889 Aug-06-2023, 11:42 AM
Last Post: deanhystad
Video doing data treatment on a file import-parsing a variable EmBeck87 15 6,003 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  File "<string>", line 19, in <module> error is related to what? Frankduc 9 15,710 Mar-09-2023, 07:22 AM
Last Post: LocklearSusan
  Getting last line of each line occurrence in a file tester_V 1 1,564 Jan-31-2023, 09:29 PM
Last Post: deanhystad
  try catch not working? korenron 2 1,654 Jan-15-2023, 01:54 PM
Last Post: korenron
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 3,999 Sep-27-2022, 01:38 PM
Last Post: buran
  Multiprocessing queue catch get timeout Pythocodras 1 4,663 Apr-22-2022, 06:01 PM
Last Post: Pythocodras

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020