python两个列表相比较

center_gailv={'[30.707473754882812, 104.04808044433594]': '0.0931',
            '[30.707473754882812, 104.04533386230469]': '0.0776',
            '[30.707473754882812, 104.04258728027344]': '0.0763',
            '[30.707473754882812, 104.04670715332031]': '0.0712',
            '[30.711593627929688, 104.04258728027344]': '0.0569',
            '[30.711593627929688, 104.04808044433594]': '0.0543',
            '[30.710220336914062, 104.04670715332031]': '0.0517',
            '[30.707473754882812, 104.04396057128906]': '0.0492',
            '[30.708847045898438, 104.04533386230469]': '0.0466',
            '[30.710220336914062, 104.04396057128906]': '0.0453',
            '[30.708847045898438, 104.05082702636719]': '0.044',
            '[30.710220336914062, 104.04121398925781]': '0.0401',
            '[30.708847045898438, 104.04258728027344]': '0.0285',
            '[30.710220336914062, 104.04258728027344]': '0.0259',
            '[30.708847045898438, 104.04121398925781]': '0.0246',
            '[30.710220336914062, 104.04945373535156]': '0.022',
            '[30.707473754882812, 104.04945373535156]': '0.022',
            '[30.711593627929688, 104.05082702636719]': '0.0194',
            '[30.711593627929688, 104.04945373535156]': '0.0168',
            '[30.710220336914062, 104.04533386230469]': '0.0155',
            '[30.711593627929688, 104.04670715332031]': '0.0142',
            '[30.710220336914062, 104.04808044433594]': '0.0142',
            '[30.707473754882812, 104.05082702636719]': '0.0142',
            '[30.711593627929688, 104.04121398925781]': '0.0142',
            '[30.707473754882812, 104.04121398925781]': '0.0116',
            '[30.711593627929688, 104.04533386230469]': '0.0103',
            '[30.708847045898438, 104.04396057128906]': '0.0078',
            '[30.711593627929688, 104.04396057128906]': '0.0078',
            '[30.710220336914062, 104.05082702636719]': '0.0065',
            '[30.708847045898438, 104.04670715332031]': '0.0065',
            '[30.708847045898438, 104.04945373535156]': '0.0065',
            '[30.708847045898438, 104.04808044433594]': '0.0052'}
center_gailv=sorted(center_gailv.items(),key=lambda x:x[1],reverse=False)

distance=[('[30.710220336914062, 104.04670715332031]', 93.7538288837121), ('[30.710220336914062, 104.04808044433594]', 94.65963984748198), ('[30.711593627929688, 104.04670715332031]', 107.10710273326457), ('[30.711593627929688, 104.04808044433594]', 107.90086196015443), ('[30.710220336914062, 104.04533386230469]', 207.5862002022236), ('[30.710220336914062, 104.04945373535156]', 208.8157835784163), ('[30.711593627929688, 104.04533386230469]', 213.94787487196606), ('[30.711593627929688, 104.04945373535156]', 215.14108587086636), ('[30.708847045898438, 104.04670715332031]', 229.66070190596798)]

gailv=[]
for i in range(len(distance)):
    for k in range(len(center_gailv)):
        if distance[i][0]==center_gailv[k][0]:
            print('*********')
            gailv.append(center_gailv[k])
print('************')
print(gailv)

好的,以下是一个简单的微信小程序日期时间组件的封装示例,它包括日期选择器和时间选择器: 1. 在小程序的 components 目录下创建一个名为 "datetime-picker" 的文件夹,并在该文件夹下创建一个名为 "datetime-picker.wxml" 的文件。 2. 在 datetime-picker.wxml 文件中,编写以下代码: ```html <view class="datetime-picker"> <picker mode="date" value="{{value}}" bindchange="bindDateChange"> <view class="picker"> {{year}}年{{month}}月{{day}}日 </view> </picker> <picker mode="time" value="{{value}}" bindchange="bindTimeChange"> <view class="picker"> {{hour}}时{{minute}}分 </view> </picker> </view> ``` 3. 在 datetime-picker.wxml 文件同级目录下创建一个名为 "datetime-picker.js" 的文件,并编写以下代码: ```javascript Component({ /** * 组件的属性列表 */ properties: { value: { type: String, value: '' } }, /** * 组件的初始数据 */ data: { year: '', month: '', day: '', hour: '', minute: '', }, /** * 组件的方法列表 */ methods: { bindDateChange: function (e) { const value = e.detail.value; const date = new Date(value); const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); this.setData({ year, month, day }) this.triggerEvent('change', { value: this.data.year + '-' + this.data.month + '-' + this.data.day + ' ' + this.data.hour + ':' + this.data.minute }); }, bindTimeChange: function (e) { const value = e.detail.value; const date = new Date(value); const hour = date.getHours(); const minute = date.getMinutes(); this.setData({ hour, minute }) this.triggerEvent('change', { value: this.data.year + '-' + this.data.month + '-' + this.data.day + ' ' + this.data.hour + ':' + this.data.minute }); }, }, ready: function () { const value = this.properties.value; if (value) { const date = new Date(value); const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); const hour = date.getHours(); const minute = date.getMinutes(); this.setData({ year, month, day, hour, minute }) } else { const now = new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; const day = now.getDate(); const hour = now.getHours(); const minute = now.getMinutes(); this.setData({ year, month, day, hour, minute }) } } }) ``` 4. 在 datetime-picker 文件夹下创建一个名为 "datetime-picker.wxss" 的文件,并编写以下代码: ```css .datetime-picker { display: flex; justify-content: space-between; align-items: center; } .picker { height: 100%; display: flex; justify-content:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值