自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 python:deepcopy()

deepcopy()只复制最初的数据。对原始数据进行改变后,复制的数据还是原始值。

2022-02-08 21:01:44 787

原创 python:UnboundLocalError: local variable ‘hcf‘ referenced before assignment

示例:def hcf(x, y): """该函数返回两个数的最大公约数""" # 获取最大值 if x > y: x,y=x,y else: x,y=y,x list=[] for i in range(1,x):改为for i in range(1,x+1): if (y * i % x == 0) : list.append(i*y) print(

2022-01-29 14:26:52 1157

原创 python:求最大公约数

def hcf(x, y): """该函数返回两个数的最大公约数""" # 获取最小值 if x > y: smaller = y else: smaller = x list = [] for i in range(1, smaller + 1): if (x % i == 0) and (y % i == 0): list.append(i) hcf .

2022-01-29 14:01:46 1929

原创 python:ASCII码到字符之间的转换

i = input('请输入一个字符:')try: j = int(input('请输入一个ascii码:'))except: print('请输入一个正整数!')print(i + '对应的ASCII码为:', ord(i))print(j, '对应的字符为:', chr(j))

2022-01-29 13:30:21 2512

转载 OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.OMP: Hint

解决方法:方法一:添加下列代码import osos.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"方法二:pycharm用的anaconda的python环境直接pip install --upgrade numpy升级包

2022-01-27 22:45:47 119

原创 Python变量之间的转换

# 变量之间的转换a = input('输入第一个变量:')b = input('输入第二个变量:')# 使用中间变量tem=aa=bb=temprint('交换后的值:{}'.format(a))print('交换后的值:{}'.format(b))# 不使用中间变量a, b = b, aprint()print('交换后的值:{}'.format(a))print('交换后的值:{}'.format(b))...

2022-01-25 20:52:17 709

原创 随机数字random用法

import randomi = 0a = int(input('输入的整数为:'))b = random.randint(0, 1)print('随机生成的数字为:', b)while True: i += 1 if a == b: print('第%d次输入对了!' % i) break else: a = int(input('请再次输入一个整数: '))...

2022-01-25 20:19:46 245

原创 type object ‘h5py.h5.H5PYConfig‘ has no attribute ‘__reduce_cython__‘

问提描述:在环境keras=2.2.5,TensorFlow=1.14中,运行发现有h5py和numpy的报错。解决方法:卸载h5py,pip uninstall h5py总结:安装包之间版本不对应。参考:AttributeError: type object ‘h5py.h5.H5PYConfig‘ has no attribute ‘__reduce_cython__‘问题解决。_zhanghao_0517的博客-CSDN博客...

2022-01-24 20:29:41 2949

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除