The Problems For Using PyCharm

1、PEP 8: expected 2 blank lines after class or function definition, found 1

这里写图片描述
这个是格式规范的警告,可以直接运行,但是会影响美观吧,只要在定义函数后空两个空行,就可以消除警告了;

2、This dictionary creation could be rewritten as a dictionary literal less…

Inspection info: This inspection detects situations when dictionary creation could be rewritten with dictionary literal
j这里写图片描述
在Stackoverflow里面看到,在定义下面添加pass
这里写图片描述

3、Inspection info: This inspection detects names that should resolve but don’t. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

这里写图片描述
此时我们对属性的操作是动态绑定的,是在程序运行的过程中对class添加的功能,我们只要在类中对属性进行限制,即允许动态绑定的属性进行说明

class Student(object):
    __slots__ = ('name', 'age', 'set_age')
    pass

这里写图片描述

4、使用ImageFont设置字体时出错,即:

font = ImageFont.truetype('Arial.ttf', 36)

这里写图片描述
给字体添加路径C:\Windows\Fonts[要添加的字体],例如:

font = ImageFont.truetype('C:\\Windows\Fonts\Arial.ttf', 36)

这里写图片描述

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值