
python
求知小菜鸟
一只笨笨的但是有一个求知欲的小小鸟。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ubuntu16.04 python2.7安装pcl
ubuntu16.04 python2.7安装pclpcl-python的Ubuntu16.04安装—使用apt安装的PCL原创 2021-10-04 11:50:02 · 324 阅读 · 0 评论 -
pip错误 ImportError: No module named ‘pip_internal‘-详细解决步骤
pip错误 ImportError: No module named ‘pip_internal’遇到这种问题,网上很多这方面的教程,但是写的很不详细,所以会走很多弯路,而且有可能解决不了。重点一:首先,遇到问题,会提示在**哪个文件夹下缺少pip._internal,就要在哪个文件夹下打开终端,属于下边的命令,不要随便在一个文件夹下打开**,这样的会会没有用。wget https://bootstrap.pypa.io/get-pip.py --no-check-certificatesudo原创 2021-03-23 11:30:20 · 1917 阅读 · 0 评论 -
python画曲线图
python画图python画线图import matplotlib.pyplot as pltx = (155,159,164,168,172)y = (48,50,53,56,60)plt.plot(x,y,alpha=0.6)plt.showpython画点图import matplotlib.pyplot as pltx = (155,159,164,168,172)y = (48,50,53,56,60)plt.scatter(x,y,alpha=0.6)plt.sho原创 2020-10-23 19:44:10 · 1003 阅读 · 0 评论 -
python函数绘制简单的曲线图像
python函数绘制简单的曲线图像样例一:import matplotlibimport matplotlib.pyplot as pltimport numpyimport mathfrom pylab import *x = numpy.linspace(-4,4,200)f1 = numpy.power(10,x)f2=numpy.power(math.e,x)f3 = numpy.power(2,x)plt.plot(x,f1,'r',x,f2,'b',x,f3,'g',l原创 2020-07-15 15:10:50 · 1543 阅读 · 0 评论 -
Python 中while与for区别
Python 中while与for区别whilewhile的一般语句格式:while 判断条件(condition): 执行语句(statements)……while的无限循环while var ==1var = 1while var == 1 : # 表达式永远为 true num = int(input("输入一个数字 :")) print ("你输入的数字是: ", num) print ("Good bye!")while 循环使用 else 语句原创 2020-07-07 15:33:04 · 4759 阅读 · 0 评论 -
Python qt5 第一个gui编写-10个对象随机排列
Python qt5 第一个gui编写-10个对象随机排列笔者运行工作环境:Ubuntu18.04Python3.6.9pyqt5在文本框中输入10个对象,可以对十个对象进行随机排列。全部代码此为全部代码,下边对代码进行解析。# -*- coding: utf-8 -*-# Form implementation generated from reading ui file '/home/li/桌面/python/qt/suijipailie.ui'## Created by: P原创 2020-07-06 21:44:56 · 372 阅读 · 0 评论 -
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xe6 in position 0: ordinal not in range(128)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe6 in position 0: ordinal not in range(128)UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe6 in position 0: ordinal not in range(128)HTMLTestRunner解决UnicodeDecodeError: ‘ascii’ codec can’t deco原创 2020-07-06 20:08:52 · 228 阅读 · 0 评论 -
Python3中字符串、列表、数组的转换方法
Python3中字符串、列表、数组的转换方法Python3中字符串、列表、数组的转换方法原创 2020-07-06 15:24:25 · 638 阅读 · 0 评论 -
Python程序以及Python GUI程序打包为exe文件
Python程序以及Python GUI程序打包为exe文件笔者运行工作环境:Ubuntu18.04qt5Python3.6.91.安装Python3-pipsudo apt install python3-pip2.利用pip3安装pyinstallerpip3 install pyinstaller3.利用pyinstaller生成exe打包程序pyinstaller 文件名.py此时已经生成了可执行程序,可执行程序在文件夹dist中。注意在Ubuntu和window下原创 2020-07-05 19:41:45 · 1272 阅读 · 0 评论 -
WARNING: The directory ‘/home/zhex/.cache/pip/http‘ or its parent directory is not owned by the curr
WARNING: The directory ‘/home/zhex/.cache/pip/http’ or its parent directory is not owned by the currWARNING: The directory ‘/home/zhex/.cache/pip/http’ or its parent directory is not owned by the curr原创 2020-07-05 19:21:12 · 2431 阅读 · 0 评论 -
Python中import, from...import,import...as的使用说明
Python中import, from…import,import…as的使用说明本文搬砖自下面博客。在python中import或者from…import是用来导入相应的模块。举例说明:通过调用datetime功能包为例:import datetimeprint(datetime.datetime.now())调用整个datetime包,然后再调用datetime这个类中的now()方法。以上代码实现功能也可以用以下代码实现:from datetime import datetime原创 2020-07-04 09:59:07 · 2275 阅读 · 2 评论 -
Python报错File “「string」“, line 1, in 「module」 NameError: name ‘q‘ is not defined
Python报错File “”, line 1, in NameError: name ‘q’ is not definedprint ("give me tow numbers,and i will divid them.")print ("enter 'q' to quit.")while True: first_number = input("\nFirst number:") if first_number == 'q': break second_原创 2020-07-03 10:16:05 · 16164 阅读 · 1 评论 -
Python中函数的定义及调用(1)
Python中函数的定义及调用(1)aa22.pydef fun(x,y): if x==y: return x+y else: return Noneprint fun(3,4)aa77.py调用aa22.pyfrom aa22 import funmy_fun = fun(6,6)print my_fun调用格式:from 文件名 import 函数名新定义xxx = 调用函数print等使用新定义xxx...原创 2020-07-02 15:01:07 · 517 阅读 · 0 评论 -
Python中类的定义以及使用(2)
Python中类的定义以及使用(2)class add(): def __init__(self,a,b): self.a=a self.b=b def dun(self): if self.a>self.b: return self.a elif self.a==self.b: retur原创 2020-07-02 11:35:50 · 537 阅读 · 0 评论 -
Python函数的定义以及if语句的使用
Python函数的定义以及if语句的使用if-else语句:def dun(a,b): if a>=b: return a else : return bprint dun(2,4)结果输出:4if-elif-else语句def dun(a,b): if a>b: return a elif a==b: return a+b else : return b原创 2020-07-02 10:14:15 · 1602 阅读 · 0 评论 -
Python中函数和类的定义和使用(1)
Python中函数和类的定义和使用python 一个.py文件如何调用另一个.py文件中的类和函数在调用另一个函数或者类时 ,为了区分调用哪个函数或者类,需要在函数名后加点。例如:调用类car中定义的函数get_descriptive,需要导入类,然后调用。car.pyclss car(): def __init__(self,make,model,year): self.make=make self.model=model self.y原创 2020-07-01 10:29:07 · 2037 阅读 · 0 评论 -
python中return的作用总结
python中return的作用总结原创 2020-06-30 22:04:59 · 1007 阅读 · 0 评论 -
Python中的异常处理和try-except的用法
Python中的异常处理和try-except的用法Python中的异常处理和try,except的用法[python]对于try…except的用法原创 2020-06-30 10:31:16 · 2540 阅读 · 0 评论 -
Python中if__name__ ==》《__main____init__和self的解析
Python中if__name__ ==》《__main____in it__和self的解析Python中if name == ‘main’,__in it__和self 的解析原创 2020-06-29 19:30:14 · 3971 阅读 · 0 评论 -
python中类的调用import函数
创建一个类模块,文件名为Dog:class Dog(): def __init__(self,name,age): self.name = name self.age = age def sit(self): print(self.name.title() + " is now sitting.") def roll_ove...原创 2020-02-15 09:42:27 · 2840 阅读 · 0 评论 -
python中类的创建方法
例子:创建dog类class Dog(): def __init__(self,name,age): self.name = name self.age = age def sit(self): print(self.name.title() + " is now sitting.") def roll_over(self)...原创 2020-02-14 20:40:54 · 890 阅读 · 0 评论 -
python中.title()等字符串大小写修改的使用
.title()是将小写字符串的首字母变为大写.upper()是将字符串的字母全部变为大写.lower()是将字符串的字母全部变为小写例子:name = 'python'print(name.title())print(name.upper())print(name.lower())结果PythonPYTHONpython...原创 2020-02-14 20:00:17 · 814 阅读 · 0 评论 -
python 实参与形参
python中实参与形参从名字就可以看出,实参是一个实实在在存在的参数,是实际占用内存地址的,而形参只是意义上的一种参数,在定义的时候是不占内存地址的,如在上面例子中,username就是一个形参,尼古拉斯赵四是我在调用函数时传入的一个实参,它的值被存储在形参username中。形参例子:def user(username): """内部代码块""" print("Hello...原创 2020-01-10 14:48:42 · 2336 阅读 · 0 评论 -
python import函数使用
import函数调用整个模块例子:首先建一个python文件pizza.pydef make_pizza(size,*toppings): print('\nmaking a' + str(size)+'-inch pizza with the following topping') for topping in toppings: print('-' + ...原创 2020-01-10 11:21:27 · 14453 阅读 · 3 评论 -
python 函数定义以及使用
例子def print_models(unprinted_designs,completed_models): print(unprinted_designs) print(completed_models) while unprinted_designs: current_design = unprinted_designs.pop() ...原创 2020-01-10 10:50:29 · 264 阅读 · 0 评论