我有以下代码不支持的格式字符?
import urllib.request
niveau_zoom_satellite = 0.0001389
def Image(coordinates, image_size, name):
d1 = "http://eumetview.eumetsat.int/geoserv/wms?LAYERS=overlay%3Ane_10m_coastline%2Coverlay%3Ane_10m_admin_0_boundary_lines_land&STYLES=&TRANSPARENT=TRUE&FORMAT=image%2Fpng8&VERSION=1.3.0&TILED=true&EXCEPTIONS=INIMAGE&SERVICE=WMS&REQUEST=GetMap&CRS=EPSG%3A4326&BBOX=47.640001058578,3.520001411438,48.880001068115,4.7600014209747&WIDTH=256&HEIGHT=256" % \
(niveau_zoom_satellite,
coordinates[0],
coordinates[1],
image_size[0]/2,
image_size[1]/2,
image_size[0],
image_size[1])
for line in urllib.request.urlopen(d1):
if line.startswith("<td align=left><input type=image src="):
d2 = "http://http://eumetview.eumetsat.int/%s" % (line.split("\"")[1],)
break
urllib.request.urlretrieve(d2, name)
if __name__ == '__main__':
Image((4.37337, 47.43572), (256, 256), "test.jpg")
,问题是
ValueError: unsupported format character 'A' (0x41) at index 58
什么线引发错误? – IsaacDj
什么行?我怀疑你需要躲避字符串中的''%作为这样一个问题:https://stackoverflow.com/questions/8856523/valueerror-unsupported-format-character-while-forming-strings – doctorlove
错误在该行7 (IMAGE_SIZE [1])((((文件 “C:/Users/RIDHA/.PyCharmCE2017.1/config/scratches/33.py”,第26行,在 图片((4.37337,47.43572),(256, 256), “test.jpg放在”) 文件 “C:/Users/RIDHA/.PyCharmCE2017.1/config/scratches/33.py”,第17行,在图像 IMAGE_SIZE [1]))) –
rida