Python Forum
i woule a way to parse a line python source like split
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i woule a way to parse a line python source like split
#3
yeah, i am looking to modify code. but i am also looking to test if lines of code have a matching pattern. if so, the line will be subject to modification. if not, the line will be printed in whole. some modifications may need to wait until some later lines to determine what the modification is. some lines could be deleted.

the most difficult part is that things i will be looking for could be in quoted string literals. something that breaks up code from quoted string literal contents and comments would be useful, i think.

it is possible that a comment line or a comment at the end of a line could match the pattern as a false-positive. a # could be in a string literal giving a false appearance of a comment. comments could be a tough issue though not as tough for Python as C/Pike code was when i have needed to modify it, due to embedded comments.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: i woule a way to parse a line python source like split - by Skaperen - Nov-11-2018, 07:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to parse and group hierarchical list items from an unindented string in Python? ann23fr 0 239 Mar-27-2024, 01:16 PM
Last Post: ann23fr
  Algorithm for extracting comments from Python source code Pavel1982 6 660 Feb-28-2024, 09:52 PM
Last Post: Pavel1982
  [split] Parse Nested JSON String in Python mmm07 4 1,612 Mar-28-2023, 06:07 PM
Last Post: snippsat
  python move specific files from source to destination including duplicates mg24 3 1,142 Jan-21-2023, 04:21 AM
Last Post: deanhystad
  Python Snippets Source kucingkembar 0 663 Oct-18-2022, 12:50 AM
Last Post: kucingkembar
  python read iperf log and parse throughput jacklee26 4 2,874 Aug-27-2022, 07:04 AM
Last Post: Yoriz
  How to parse a live feed in Python? Daring_T 2 4,225 Jan-20-2022, 04:17 AM
Last Post: Daring_T
  multi-line CMD in one-line python kucingkembar 5 4,121 Jan-01-2022, 12:45 PM
Last Post: kucingkembar
  Long-term stable source to get news headlines with Python? sandufi 4 1,990 Dec-23-2021, 09:48 AM
Last Post: sandufi
  Navigating cpython source using python quazirfan 3 2,073 Aug-09-2021, 07:52 PM
Last Post: quazirfan

Forum Jump:

User Panel Messages

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