
Python小白
种一抹馨香
愿人们沉睡时,纷纷梦见永不落地的星辰;愿人们喝醉时,纷纷想起年少时读过的诗篇!!!
展开
-
python django(1170, "BLOB/TEXT column 'name' used in key specification without a key length)
今天,在给django建模型(表)的时候,报django.db.utils.InternalError: (1170, “BLOB/TEXT column ‘name’ used in key specification without a key length”)错误这是因为mysql为BLOB或者TEXT字段使用了未指定键值长度的键但是改了模型也无法解决`class User(mode...原创 2020-01-11 11:50:38 · 3786 阅读 · 0 评论 -
关于Python orm创建数据库的时候报ERROR 1067: Invalid default value for"creat_time"的解决方案
Python使用SQLAlchemy,创建ORM的一个表,表如下class User_info(Base): """define User_infoitem""" __tablename__ = 'User_info' id = Column(Integer, primary_key=True) name= Column(String(50), doc=u"用户"...原创 2020-01-07 09:38:36 · 491 阅读 · 0 评论 -
Python3.0面向对象——类
说明:学习资料来自于《Python编程:从入门到实践》,如果想深入学习可以去买这本书看看1.类的说明:1.1基于类创建对象,每个对象都自动具备这种的通用行为;1.2根据类来创建对象被称为实例化;1.3类中的函数被称为方法2.实例#2.1 创建一个名为Restaurant的类class Restaurant(): """设置属性""" def __init__(self...原创 2019-08-06 16:37:50 · 302 阅读 · 0 评论 -
Python遍历字典
参考书籍:《Python编程:从入门到实践》1.使用一个字典存储一个熟人的信息,包括名,姓,年龄和居住的城市friend_info={ 'first_name':'sheen', 'last_name':'sherly', 'age':29, 'city':'Manila'}print(friend_info['first_name'],'11\n')pri...原创 2019-07-26 16:46:11 · 574 阅读 · 0 评论 -
Python的If条件判断练习
练习题来自于《Python编程:从入门到实践》#5.1假设在游戏中刚射杀了一个外星人,请创建一个名为alien_color的变量,并将其设置#为'green'、'yellow'或'red'aline_color=('green','yellow','red')if 'green' in aline_color: print('Get 5 point')if 'yellow...原创 2019-07-25 18:44:40 · 1105 阅读 · 0 评论 -
《Python入门到实践》--遍历整个列表练习
4.1练习#4.1想出三种es结尾的单词,遍历整个数组,打印出来foods=['tomatoes','heores','potatoes']'''for food in foods: print(food)'''#4.1修改4.1for循环,使其每一行显示一句话,但是包含其名称for food in foods: print("I like" ,food.title())...原创 2019-07-17 16:11:45 · 460 阅读 · 0 评论 -
learning Python rules
You should remember these principles when you study Python. Input “Import this” on the Python IDE, Enter, the following should run through your entire programmer and operation career:1.Beautiful is ...原创 2019-07-13 16:05:13 · 405 阅读 · 1 评论 -
20190703Python学习笔记
2019/7/3 Python学习笔记说明:学习教材来自于菜鸟教程,如果想看更全面的内容请访问菜鸟教程: https://www.runoob.com/python3/python3-loop.html1.十进制转化其他进制的方法在这里插入代码片#usr/bin/python3while True:number =input(‘请输入一个整数(输入S...原创 2019-07-03 19:51:53 · 145 阅读 · 0 评论 -
20190702 Python学习笔记
2019/7/2 Python学习笔记说明:所有的学习都来自于菜鸟教程Python3菜鸟教程地址:https://www.runoob.com/python3/python3-loop.html1.Python的循环语句1.1 Python没有do…while循环;1.2 Python中可以用ctrl+C来终止无限循环;1.3 可以用Range()函数遍历数字序列;1.3.1 f...原创 2019-07-02 20:43:10 · 445 阅读 · 0 评论