python基础语法2.2.5:Python基础1.10
python基础语法2.2.5:Python基础1.10https://study.163.com/provider/480000002230206/index.htm?share=2&shareId=480000002230206更多内容请见网易云课堂Python大数据学习吧:L1=[float(L[0][:7]) float(L[1][:7]) float(L[2][:7]) float(L[3][:7])]L2=[float(L[0][7:]) float(L[1][7:]) float(L[2][7:]) float(L[3][7:])]运行结果如下图:
1.10 将列表L=[‘113.980 22.566’ ‘113.940 22.686’ ‘113.957 22.576’ ‘114.244 22.564 ‘]中的经纬度字符型数据,按经度和纬度拆分出来并转换为数值类型,分别存储为两个不同的列表L1和L2。
[知识点及要求]字符串拆分和子串查找
示例代码如下:
L=['113.980 22.566' '113.940 22.686' '113.957 22.576' '114.244 22.564']
L1=[float(L[0][:7]) float(L[1][:7]) float(L[2][:7]) float(L[3][:7])]
L2=[float(L[0][7:]) float(L[1][7:]) float(L[2][7:]) float(L[3][7:])]
运行结果如下图:
更多内容请见网易云课堂Python大数据学习吧:
https://study.163.com/provider/480000002230206/index.htm?share=2&shareId=480000002230206