![](https://img-blog.csdnimg.cn/20190927151132530.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
python学习笔记
试试,总能学会的
遥感地学小站
通过记录让自己更加热爱
展开
-
python 实现去除字符串的首尾空格
def trim(s): if s == '': return s elif s[0] == ' ': return trim(s[1:]) elif s[-1] == ' ': return trim(s[:-1]) else: return s原创 2020-09-28 19:12:54 · 1152 阅读 · 0 评论 -
python 求一元二次方程的解
import math def quadratic(a, b, c): if not isinstance(a + b + c, (int, float)): # 验证输入的三个参数是不是数字 raise TypeError("bad operand type") if (b ** 2 - 4 * a * c) < 0: print("these is no solution") else: nx1 = (-b + ...原创 2020-09-28 16:13:55 · 2045 阅读 · 0 评论 -
python 读取csv文件
python读取所需的csv文件 #需要导入pandas模块 import pandas #使用read_csv()方法 df = pandas.read_csv("shows.csv") print(df) 可csv文件可以通过excel文件转换,但需要注意的是,不能直接更改excel的后缀,这样会报错 正确方法是打开excel文件,“文件”--“另存为”,将格式转换成csv ...原创 2020-09-23 15:14:14 · 794 阅读 · 0 评论