python - urls.py 正则表达式帮助坐标
我尝试搜索但找不到答案。
我正在尝试编写一个接受坐标(即纬度和经度)的函数。例如,53.345633,-6.267014
。
然后,这些信息将作为用户当前位置以及前往附近某些地点的方向(我已经将这些位置存储在某处)输入到 Google 地图 API 中,并且有望返回方向。
所以,我几乎已经完成了所有的地图工作,但我无法测试它,因为令人沮丧的是,我根本无法找出 urls.py 内部的正则表达式。
谁能帮我解决这个问题吗?我希望它对你们来说足够简单。我之前尝试过,但惨败!这太令人沮丧了,因为我也快要完成这一部分了!!
感谢您的帮助!
PS 带逗号的坐标格式是否可取?也许 53.345633+-6.267014
会更好(然后我可以使用 my_coords = coords.replace("+", ", ")
或其他东西)?
I tried searching but could not find an answer for this.
I am trying to write a function that takes in coordinates, ie latitude and longitude. For example, 53.345633,-6.267014
.
These will then be fed into the Google Maps API as the users current location, and directions to some nearby places (I already have these locations stored somewhere) and the directions will hopefully be returned.
So, I pretty much have all the Maps work done, but I can't test it because, frustratingly enough, I simply cannot figure out the regex for inside urls.py
.
Can anyone help me with this? I'm hoping its simple enough for you guys. I tried it earlier but failed miserably! It's so frustrating coz I'm so close to finishing this part too!!
Thanks for the help!
PS Is the format for coordinates advisable, with the comma? Perhaps 53.345633+-6.267014
would be better (then I can just use my_coords = coords.replace("+", ", ")
or something)??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定我明白了,但你可以尝试类似 :
或 regex 的东西:
I'm not sure I get it but you can try something like :
or regex :
如果您希望点是可选的。
If you want the dot to be optional.