У меня есть XML-файл, который выглядит следующим образом:
Study design
This is a secondary analysis of the Childhood Acute Illness and Nutrition (CHAIN) Network prospective cohort which, between November 2016 and January 2019, recruited 3101 children at nine hospitals in Africa and South Asia: Dhaka and Matlab Hospitals (Bangladesh), Banfora Referral Hospital (Burkina Faso), Kilifi County, Mbagathi County and Migori County Hospitals (Kenya), Queen Elizabeth Hospital (Malawi), Civil Hospital (Pakistan), and Mulago National Referral Hospital (Uganda). As described in the published study protocol,
11
children were followed throughout hospital admission and after discharge with follow-up visits at 45, 90 and 180-days post-discharge. Catchment settings differed in urbanisation, access to health care and prevalence of background comorbidities such as HIV and malaria. Prior to study start, sites were audited to optimise care as per national and World Health Organisation (WHO) guidelines.
12
Cross-network harmonisation of clinical definitions and methods was prioritised through staff training and the use of standard operation procedures and case report forms (available online,
https://chainnetwork.org/resources/
).
Как извлечь текст из элемента
с помощью BeautifulSoup?
Решение этой проблемы с помощью код ниже, похоже, не работает.
with open('test.xml', 'r') as file:
soup = BeautifulSoup(file, 'xml')
# Find and print all tags
for tag in soup.find_all('sec'):
print(tag.text)
Подробнее здесь: https://stackoverflow.com/questions/793 ... utifulsoup
Как извлечь текстовое содержимое из тега XML с помощью beautifulsoup ⇐ Python
Программы на Python
1737106151
Anonymous
У меня есть XML-файл, который выглядит следующим образом:
Study design
This is a secondary analysis of the Childhood Acute Illness and Nutrition (CHAIN) Network prospective cohort which, between November 2016 and January 2019, recruited 3101 children at nine hospitals in Africa and South Asia: Dhaka and Matlab Hospitals (Bangladesh), Banfora Referral Hospital (Burkina Faso), Kilifi County, Mbagathi County and Migori County Hospitals (Kenya), Queen Elizabeth Hospital (Malawi), Civil Hospital (Pakistan), and Mulago National Referral Hospital (Uganda). As described in the published study protocol,
11
children were followed throughout hospital admission and after discharge with follow-up visits at 45, 90 and 180-days post-discharge. Catchment settings differed in urbanisation, access to health care and prevalence of background comorbidities such as HIV and malaria. Prior to study start, sites were audited to optimise care as per national and World Health Organisation (WHO) guidelines.
12
Cross-network harmonisation of clinical definitions and methods was prioritised through staff training and the use of standard operation procedures and case report forms (available online,
https://chainnetwork.org/resources/
).
Как извлечь текст из элемента
с помощью BeautifulSoup?
Решение этой проблемы с помощью код ниже, похоже, не работает.
with open('test.xml', 'r') as file:
soup = BeautifulSoup(file, 'xml')
# Find and print all tags
for tag in soup.find_all('sec'):
print(tag.text)
Подробнее здесь: [url]https://stackoverflow.com/questions/79363898/how-to-extract-text-content-under-an-xml-tag-using-beautifulsoup[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия