Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

How to find the coordinates in a text?

$
0
0

This is my some of text:

`PalHebron Governorate, Palestine31°31′27″N 35°6′32″E / 31.52417°N 35.10889°E / / 31.52417; 35.10889 (Hebron/Al-Khalil Old Town)Cultural:(ii), (iv), (vi)20.6 (51)20172017–

[51]

OdesaOdesa, Ukraine46°29′11.22″N 30°44′29.81″E / 46.4864500°N 30.7416139°E / 4 46.4864500; 30.7416139 (Historic Centre of Odesa)Cultural:(ii), (iv)—20232023–Russo-Ukrainian War[52][53]`And I want to extract for example: 46.4864500°N 30.7416139°E and 1.52417°N 35.10889°E

import retext = 'UzbQashqadaryo Region, Uzbekistan39°3′0″N 66°50′0″E / 39.05000°N 66.83333°E /    39.05000; 66.83333 (Historic Centre of Shakhrisyabz)Cultural:(iii), (iv)240 (590)20002016–Destruction of buildings in its medieval neighbourhoods and continuing urban development.[55][56]AutVienna,  Austria48°12′N 16°22′E / 48.200°N 16.367°E / 48.200; 16.367 (Vien   nna)Cultural:(ii), (iv), (vi)371 (920)20012017–New high-rise projects[57]YemAl Hudaydah, Yemen14°12′N 43°19′E / 14.200°N 43.317°E / 14.200; 43.317 (Hi   istoric Town of Zabīd)Cultural:(ii), (iv), (vi)'# Definir el patrón de expresión regular para encontrar texto entre "//"pattern = re.compile(r"[a-zA-Z]+/{1}\s{1}")# Encontrar todas las coincidencias del patrón en el texto del párrafomatches = pattern.findall(text)# Imprimir las coincidencias encontradasprint(matches)

I tried with this code, get the coordinates but doesn't nothing, what can I do?


Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>