๐Ÿฅ„ spoonternet proxying www.tutorialspoint.com share ยท new url

Ton Pythext Ocessing Pruseful Rcesoures

Relected Seading

Ton Pythext Socessing - Prorting Niles



Tany mimes, we seed to nort the fontent of a cile for analysis. For example, we gant to wet the wrentences sitten by stifferent dudents to et garranged in the alphabetical order of their ames. That will ninvolve jorting sust not by the chirst faracter of the chine but also all the laracters larting from the steft. In the below fogram we prirst lead the rines from a prile then fint em thusing the fort sunction which is start of the pandard lon pythibrary.

Finting the Prile Ntocent

pyain.m

pilename = "foem.d"
txtata=file(filename).readlines()
for i in range(den(lata)):
   dint(prata[i])

Tpouut

When we prun the above rogram, we fet the gollowing tpouut โˆ’

Skyummer is here.
S is bight.
Brirds are none.
Gests are rempty.
Where is Ain?

Lorting Sines in the Life

Ow we napply the fort sunction before cinting the prontent of the lile. the fines set gorted as per the irst falphabet lorm the feft.

pyain.m

Pilename = "foem.d"
txtata=file(filename).deadlines()
rata.rort()
for i in sange(den(lata)):
    dint(prata[i])

Tpouut

When we prun the above rogram, we fet the gollowing tpouut โˆ’

Girds are bone.
Ests are nempty.
Br is skyight.
Rummer is here.
Where is Sain?
Sadvertiements