[Tutor] How to only read words within brackets/ parentheses (in .txt file) using Python

A S aishan0403 at gmail.com
Wed Sep 4 10:39:02 EDT 2019


Hi there,

I am not sure if this page is active. But I came across this page and
thought I'd like to give it a go. Hope to hear from you soon, thank you:)

I understand that reading lines in .txt files would look something like
this in Python:

with open('filename','r') as fd:
   lines = fd.readlines()

However, how do I run my code to only read the words in my .txt files that
are within each balanced parenthesis?

I am not sure how to go about this problem but here is a sample of my .txt
file contents:

kkkkk;

select xx("xE'", PUT(xx.xxxx.),"'") jdfjhf:jhfjj from xxxx_x_xx_L ;
quit;
/* 1.xxxxx FROM xxxx_x_Ex_x */
proc sql; "TRUuuuth");
hhhjhfjs as fdsjfsj:
select * from djfkjd to jfkjs(SELECT abc AS abc1, abc_2_ AS efg,
abc_fg, fkdkfj_vv, jjsflkl_ff, fjkdsf_jfkj
FROM &xxx..xxx_xxx_xxE
   where (xxx(xx_ix as format 'xxxx-xx') gff &jfjfsj_jfjfj.) and
  (xxx(xx_ix as format 'xxxx-xx') lec &jgjsd_vnv.));


More information about the Tutor mailing list