Python temporarily change letter to lower case -
i have list looks this:
separate=[['i','wnet','to','the','mal,'],['and','bouht','a','new','shirt.'],['what','did','you','do','todya?']]
i'm going run through program identify misspelled words , replace them correct word list of words in webster dictionary
using uses lowercase letters. can temporarily change of letters lowercase in end return original upper , lower case words?
i know str.upper()
, str.lower()
, set.capitalize
.
it seems want use str.capwords()
inversely... want split list words(already done) , make capital letters lower case.
just use str.lower
. return new string lower letter , keep original string unchanged. when loop through list such if string.lower() in adict:
, use lower case compare , original string unchanged.
>>> = 'abc' >>> a.lower() 'abc' >>> 'abc'
Comments
Post a Comment