
python
austin1000
这个作者很懒,什么都没留下…
展开
-
python小技巧收集(持续更新)
python小技巧收集字符串转数字及数字转字符串字符串转数字及数字转字符串常见于从数据库中取出来的字符串存储的数组,需要转为listclass _UtilPort(object): def _char2IntList(self, char): if len(char) <= 0: return [] return list(set(map(int, char.split(',')))) def _intList2char(原创 2020-08-04 10:19:20 · 162 阅读 · 0 评论 -
python ui 获取文件目录
python ui获取文件目录的两种方法原创 2016-01-21 09:50:33 · 2277 阅读 · 1 评论 -
pycharm配置py文件模板
pycharm提供了强大的python编辑和运行环境,但使用pycharm新建py文件时,并不会自动添加py文件的编码格式,因此需要修改pycharm配置,使之新建py文件时自动添加头部注释,方法如下:File->settings->Editor->File and Code Templates->Python Script 添加以下代码#!/usr/bi...原创 2017-07-21 15:20:02 · 1171 阅读 · 0 评论 -
python tkinter界面中添加按钮的方法
tkinter是python自带的GUI库,可以实现简单的GUI交互,该例子添加了五种不同效果的Button,如图:from tkinter import *from tkinter import messagebox #python3.0的messagebox,属于tkinter的一个组件top = Tk()top.title("button test")def callback(原创 2016-03-12 23:11:43 · 12465 阅读 · 1 评论 -
帮助文档不全的情况下,如何查看python的类的属性及方法
python不像java、C++等语言,有严格的类声明,因此在没有详细的帮助文档时如何查看各种类的变量(属性)和方法(函数)成了一个头疼的问题,本文经过实践,总结了四种python下查看类的属性和方法的常用方法:dir、vars、type、help原创 2019-10-09 17:48:54 · 393 阅读 · 0 评论