《自学是门手艺》Part.1.E.7 找到英文字母数值之和等于100的字母

这篇学习笔记介绍了如何使用Python来查找所有字母数值相加等于100的字母,强调了在读取文件时需要指定完整路径,并且txt文件保存时应采用UTF-8编码格式。
摘要由CSDN通过智能技术生成

学习笔记

  1. 读取文件时,必须写完整的文件所在路径,才能open file.
  2. 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值