学习笔记:
- 读取文件时,必须写完整的文件所在路径,才能open file.
- txt文件需要另存为UTF-8格式。
with open('Desktop/english-words-master/english-words-master/words_alpha.txt', 'r') as file:
for word in file.readlines():
pass # 先用 pass 占个位,一会儿再写计算过程
ord('a')
97
word = 'kownledge'
sum = 0
for char in word:
sum += ord(char) - 96
print(sum)
96
def sum_of_word(word):
sum = 0
for char in word:
sum += ord(char) - 96
return sum
sum_of_word('attitude')
100
def sum_of_word(word):
sum = 0
for char in word:
sum += ord(char) - 96
return sum
with open('Desktop/english-words-master/english-words-master/words_alpha.txt', 'r') as file: #要写完整文件路径,否则会有报错([Errno 2] No such file or directory).txt另存为UTF-8,才不会出现UnicodeDecodeError
for word in file.readlines():
if sum_of_word(word) == 100:
print(word)
abstrusenesses
acupuncturist
adenochondrosarcoma
adenomyxosarcoma
adscititiously
adsorptiveness
anaglyptography
anesthetization
anisophyllous
annihilationistic
anomophyllous
anthropopathite
anthropophaginian
antiagglutinating
antianaphylactogen
antibacteriolytic
antichristianism
anticyclolysis
anticytolysin
anticommutative
anticonvulsive
antieducationally
antiexpressive
antimilitaristic
antimissionary
antipestilential
antiprofiteering
antirepublicanism
aponogetonaceous
apostrophising
apperceptionist
aristocratically
aristodemocratical
arthrolithiasis
associationalist
assortatively
astigmatometry
atherosclerosis
autoeciousness
autointoxicant
autoprothesis
autosymbiontic
benzoglyoxaline
benzothiodiazole
bioastronautics
bisymmetrically
blennocystitis
carposporangium
chondropterygii
chromolithograph
cytoplasmically
cochromatography
collenchymatous
commercialization
communalization
competitorship
complementalness
compossibility
congressionist
conjecturableness
consolitorily
contemplatingly
contradictorily
contrapositive
controllableness
cooperativeness
cosponsorship
counsellorship
counterpassant
counterpotent
counterspying
countertendency
counterworker
countrywomen
craspedodromous
cryptanalytics
cryptostomata
cultivatability
cultrirostral
curvilinearity
dacryostenosis
dehydrosparteine
demonstrability
demonstrations
denominationalize
dephlogistication
dermorhynchous
desophistication
desoxycinchonine
desterilization
diathermotherapy
dyschromatopsia
discriminatingly
dyscrystalline
discursiveness
disenfranchisement
disfranchisements
disgustingness
dispensatorily
draftswomanship
duplicitously
electrobiologist
electrocardiograms
electrodepositable
electromagnetist
electromuscular
electroresection
electroviscous
embourgeoisement
endotheliolysin
epistolography
erythrolitmin
erythropoietic
eurytopicity
eventognathous
existentialist
experientialist
experimentative
expostulator
exquisiteness
extemporalness
exterminations
externalisation
extraconscious
extradictionary
ferromolybdenum
fibroligamentous
firmisternous
flavorlessness
flavorousness
forerunnership
forthrightness
frictionlessly
fruitlessness
gastrolatrous
geomorphogenist
gymnospermism
gyrophoraceous
gyrostabilizer
governmentalize
gravitationally
guanidopropionic
hastatosagittate
helminthologist
hematocytometer
hemotherapeutics
hydrargyrosis
hydroergotinine
hydronitrous
hydrophyllium
hydroquinoline
hydrotherapist
hyperalkalinity
hyperbrachycephalic
hyperimmunized
hyperthermally
hyporrhythmic
hyposensitive
hypostatically
hypostomous
hippocastanaceous
hipponosology
hipponosological
hysterocleisis
historiographer
homeomorphisms
homotransplant
iliohypogastric
immunologists
immunotherapies
imposturous
impoverishment
impropriatrix
incommutability
inconstantness
incorporations
incuriousness
indispensableness
industrializes
intensifications
intensitometer
intercursation
interirrigation
interjectionary
interpretress
intersituating
interstimulate
intraformational
intraleukocytic
intuitionless
intuitiveness
intussuscept
irrespectively
isopropylacetic
yttrogummite
lactiferousness
laryngocentesis
levorotatory
limonitization
liverwursts
locomotiveness
lotophagously
lubriciousness
luciferousness
maldistribution
mammatocumulus
manuscriptural
martyrolatry
masculinization
melanospermous
mercuriammonium
mesmerizability
mesopterygium
metempsychosical
metropolitancy
metroscirrhus
mycosymbiosis
microphyllous
microprocessor
ministerialness
myodynamometer
myringodectomy
misinterpretable
monoeciousness
monopropellant
monumentalising
morphologists
multicomputer
multilinguist
multimetallist
multistratified
necessitously
nesslerization
neurapophysis
neurilemmatous
neurosurgery
neutroclusion
nonagricultural
nonappointment
nonarticulation
nonattainability
nonbituminous
nonblunderingly
noncohesiveness
noncollectively
noncommittally
nonconstraining
noncontiguity
noncruciformly
noncuriously
nondeductibility
nonderogatively
nondisruptive
nondissipatedly
nondistortion
nonegregiously
nonemulously
nonequivocating
nonestimableness
noneuphonious
nonexternalized
nonextrusive
nonfestiveness
nonformidability
nonfrequently
nonimperialistic
nonindulgently
noninfiniteness
noninheritabness
nonintersecting
noniridescently
nonleprously
nonmanipulative
nonmathematically
nonmischievous
nonnarcissistic
nonoutlawries
nonparticipating
nonpermanently
nonpersecutive
nonperseverant
nonphilosophy
nonphilosophical
nonpoisonous
nonpreciously
nonpredatorily
nonprotesting
nonpsychopathic
nonpuerilities
nonrecuperative
nonrehabilitation
nonrenunciation
nonresonantly
nonretrenchment
nonromantically
nonsanctification
nonsculptural
nonsecretively
nonsensibility
nonsensification
nonsentiently
nonseriously
nonsolubleness
nontemperamental
nontheistically
nontypicalness
nonubiquitary
nonupholstered
nonusurious
nonvulgarities
normalizations
octophthalmous
oligophyllous
omniproduction
operationalistic
ophthalmencephalon
ophthalmoscopy
ophthalmoscopical
opinionatively
optimizations
ornithopteris
orthodoxality
orthotropism
ossiculotomy
ostensibilities
osteomyelitis
ostreiculture
ovariectomizing
overaccentuation
overbashfulness
overcaustically
overcommendation
overcourtesy
overdefensively
overfearfulness
overgesticulated
overjoyfully
overliveliness
overnarrowly
overnationalize
overnumerous
overroughness
oversensitize
overslowness
overstrictly
overthrowers
overtruthful
overvigorous
palaeodictyoptera
paleoethnography
paleomammologist
parametrization
parasigmatismus
parentheticality
participatively
patronizingly
penetratingness
perityphlitis
permittivity
perniciousness
persnicketiness
petrographically
petromyzonidae
petrosiliceous
phylloptosis
physicochemically
phytogeography
phytogeographical
photographically
photoptometer
photosynthate
phthisiologist
pyrenocarpous
pyroantimonate
pyrophorous
pyrotechnically
pleocrystalline
pleurosaurus
plumbosolvent
plurivorous
pneumatogenous
pneumatometry
pneumonotomy
poecilocyttares
pointlessness
polariscopically
polychromatize
polyembryonate
popularisation
posterishness
posteruptive
posteternity
postexistent
posttreatment
pratiyasamutpada
preacknowledgment
preassumption
precorruptive
predesirously
predetermination
preindependently
preintercourse
preprocessors
prereconciliation
presymphysial
presuitability
presupplicating
preteressential
preventionist
prioristically
proacquisition
proauthority
procompulsion
prodeportation
professionalised
professionally
profitmongering
progeotropism
prognostically
prohostility
proletarianness
propolization
proportionated
proportioning
protomagnesium
protomeristem
protorosauria
protosulphate
prototrophy
protractility
providentialism
proximolingual
pseudodipteros
pseudofoliaceous
pseudonymity
pseudopermanent
pseudosophist
psychiatrists
psychoanalysis
pterylography
pterylographical
pteroclomorphic
pumpkinification
pupilloscoptic
purposefully
pussyfooting
quadricentennials
quarterstaves
querulously
questionnaires
quinquelocular
quinquepetaloid
quinquevalency
rapturously
reassortments
recollectiveness