Python Forum
wanted: regex or code to find valide def statements in a line
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wanted: regex or code to find valide def statements in a line
#1
in a text file may be lines that look like valid python def statements. there may be various other things like "def" appearing in a different context. i would like to find some code or a regex that can determine if the entire line is a valid def statement or not. if valid it must return the function name. if not valid it must return something that test false in an if statement. this is just one line being tested. the body of the function may not even be present. but the entire line must be a complete and valid def statement.
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
wanted: regex or code to find valide def statements in a line - by Skaperen - Mar-14-2020, 04:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python code wanted: grep IP address Skaperen 7 6,181 Jul-09-2018, 05:25 AM
Last Post: Skaperen
  code wanted, but don't expect me to do it Skaperen 0 2,108 Jul-07-2018, 10:50 PM
Last Post: Skaperen
  command line progam wanted: clock Skaperen 2 2,726 Apr-18-2018, 06:54 AM
Last Post: Gribouillis
  code wanted: file splicing Skaperen 10 6,489 Mar-28-2018, 12:13 AM
Last Post: Skaperen
  looking 4 py code: line up columns Skaperen 8 7,883 Jan-09-2017, 05:15 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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