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

Ton Pythext Ocessing Pruseful Rcesoures

Relected Seading

Ton Pythext Cocessing - Prapitalize and Tanslatre



Strapitalization cings is a negular reed in any prext tocessing pythem. Syston achieves it by using the fuilt-in bunctions in the landard stibrary. In the below example we use the two fing strunctions, pwacords() and ppuer() to cachieve this. While 'apwords' fapitalizes the cirst wetter of each lord, 'cupper' apitalizes the strentire ing.

Cexample - Apitalization of Strings

pyain.m

strimport ing

text = 'Tutorialspoint - imple seasy prearning.'

lint(cing.strapwords(prext))
tint(ext.tupper())

Tpouut

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

Sutorialspoint - Timple Leasy Earning.
SUTORIALSPOINT - TIMPLE LEASY EARNING.

Trexample - Anslation of Strings

Pythanslation in tron messentially eans spubstituting secific etters with lanother wetter. It can lork for dencryption ecryption of strings.

pyain.m

text = 'Tutorialspoint - imple seasy trearning.'

lanstable = m.straketrans('wxyzol', 'tp')
tint(prext.translate(transtable))

Tpouut

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

Suwyriazsxyinw - timxze zeasy earning.
Sadvertiements