map()函数 map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回。 1、当seq只有一个时,将函数func作用于这个seq的每个元素上,并得到一个新的seq。 例如,对于list [ ...
分类:
编程语言 时间:
2021-01-26 11:49:25
阅读次数:
0
import os def remove_filename(path_dir, start, end): files = [f for f in os.listdir(path_dir) if f.startswith(start) and f.endswith(end)] for file_nam ...
分类:
编程语言 时间:
2021-01-26 11:48:41
阅读次数:
0
一、说在前面 我在用pip下载包时经常有下载比较慢和如下错误的问题 Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pipenv/ 二、解决方法 默认pip是使用Python官方的源,但是由于国外官方源经常被墙,导致不可用,我 ...
分类:
编程语言 时间:
2021-01-26 11:47:24
阅读次数:
0
万能异常之try: except <Errortype> as <alias> : else: finally:(转) 链接: try: except <Errortype> as <alias> : else: finally: ...
分类:
编程语言 时间:
2021-01-26 11:38:53
阅读次数:
0
一、Python环境准备 远程服务器上Python版本要与本地想匹配,这里本地使用Anaconda来进行安装,远程服务器之间安装。 wget --no-check-certificate https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tgz ...
分类:
编程语言 时间:
2021-01-25 11:30:39
阅读次数:
0
Problem LeetCode Given the root of a binary tree, return the sum of every tree node's tilt. The tilt of a tree node is the absolute difference between ...
分类:
编程语言 时间:
2021-01-25 11:29:21
阅读次数:
0
感谢作者> https://www.cnblogs.com/botoo/p/11762045.html CentOS7中自带的python版本是python-2.7.5,由于新开的虚拟机需要使用python3,于是便升级一下版本。 安装Python3.7.3 官网下载地址:https://www.p ...
分类:
编程语言 时间:
2021-01-25 11:22:41
阅读次数:
0
作为一个Python菜鸡,有些常用的代码和方法还是要整理一下的: #!python3 ########################################################################################################### ...
分类:
编程语言 时间:
2021-01-25 11:18:58
阅读次数:
0
Chapter 7 - Collaborative Analytics with Plotly Segment 2 - Creating statistical charts Setting up to use Plotly within Jupyter import numpy as np imp ...
分类:
编程语言 时间:
2021-01-25 11:18:24
阅读次数:
0
编译Qt5.14.2的qtdeclarative发生错误:building qtqml requires python,系统是ubuntu18.04,安装有python3,修复需要做2步: 1.用nano或者vi修改别名文件 $ vi .bashrc 添加别名 alias python=python ...
分类:
编程语言 时间:
2021-01-25 11:14:13
阅读次数:
0