Я пытаюсь разобрать строки извлечения конкретных слов.Разбор больших строк в python
Строка
{{About|the ALGOL-like programming language|the scripting language formerly named Small|Pawn (scripting language)}}
'''SMALL''', Small Machine Algol Like Language, is a [[computer programming|programming]] [[programming language|language]] developed by Dr. [[Nevil Brownlee]] of [[Auckland University]].
==History==
The aim of the language was to enable people to write [[ALGOL]]-like code that ran on a small machine. It also included the '''string''' type for easier text manipulation.
SMALL was used extensively from about 1980 to 1985 at [[Auckland University]] as a programming teaching aid, and for some internal projects. Originally written to run on a [[Burroughs Corporation]] B6700 [[Main frame]] in [[Fortran]] IV, subsequently rewritten in SMALL and ported to a DEC [[PDP-10]] Architecture (on the [[Operating System]] [[TOPS-10]]) and IBM S360 Architecture (on the Operating System VM/[[Conversational Monitor System|CMS]]).
About 1985, SMALL had some [[Object-oriented programming|object-oriented]] features added to handle structures (that were missing from the early language), and to formalise file manipulation operations.
==See also==
*[[ALGOL]]
*[[Lua (programming language)]]
*[[Squirrel (programming language)]]
==References==
*[http://www.caida.org/home/seniorstaff/nevil.xml Nevil Brownlee]
[[Category:Algol programming language family]]
[[Category:Systems programming languages]]
[[Category:Procedural programming languages]]
[[Category:Object-oriented programming languages]]
[[Category:Programming languages created in the 1980s]]
Я хочу, чтобы извлечь Алгол, Lua (язык программирования), Белка (язык программирования) с также раздел. (Именно эти слова не должны содержать никаких скобок или звезды.)
Я пробовал эти подходы
Строка разделена, регулярные выражения. Я все еще негде, Помогите оценить.
Код, используемый мной
import urllib.request,json,re
url = "http://en.wikipedia.org/w/api.php?format=json&action=query&titles=SMALL&prop=revisions&rvprop=content"
response = urllib.request.urlopen(url)
str_response = response.readall().decode('utf-8')
obj = json.loads(str_response)
a=str(obj['query']['pages']['1808130']['revisions'][0]['*'])
print(a)
Строка хранится в.
Что вы пробовали * точно *? Я бы сказал, что вы можете разбить строку на строки, извлечь все строки между '== См. Также ==' и следующий раздел (или конец файла), а затем применить подходящее регулярное выражение для каждой строки. –
это не json, так как это могло сработать? –
Как вы @FrerichRaabe предложите мне извлечь все строки между == See Also == и в следующем разделе? используя регулярное выражение? Я написал регулярное выражение для строк в середине. т. е. «\ W \ W \ W [a-z, A-Z \ W] + \ W \ W" –