Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Paragraph assembler

aList =[
  'Exploration  well  15/9-19  SR,  drilled  to  the  Theta  Vest\n',
  'structure  in  the  Sleipner  area,  encountered  oil  in  the\n',
  'Jurassic  Hugin Formation. The drill stem test showed  very\n',
  'good production capacities through time, with low water cut\n',
  'and low GOR. A comprehensive study of the structure and the\n',
  'discovery has been performed and is reported. This includes\n',
  'seismic  and  structural  interpretations,  biostratigraphy,\n',
  'sedimentology, petrography, geochemistry, petrophysics, test\n',
  'analysis  and  resource  estimation.  The  resources  are\n',
  'calculated to 10.3 million Sm3 oil in place and 4.55 million\n',
  'Sm3 oil  recoverable.\n'
]

rList = [""] # Rectified List
cI = 0 # Current index of the list

for i in range(0,len(aList)): # Loop through all elements in the list
    if aList[i] != '\n':
        aList[i] = aList[i].replace('\n',' ') 
    if (aList[i][0].isupper()) and (". " not in aList[i]):
        cI += 1
        rList.append(aList[i])
    elif not (aList[i][0].isupper()) or (". " in aList[i]):
        rList[cI] += aList[i]
# Print out the rectified output
for rStr in rList:
	print(rStr)

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.