forked from jackfrued/Python-100-Days
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
187 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
|
||
class DemoConfig(AppConfig): | ||
name = 'demo' | ||
name = '投票' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 序列化 - 把对象写入数据流 - 串行化 / 归档 / 腌咸菜 | ||
# 反序列化 - 从数据流中恢复出对象 - 反串行化 / 解归档 | ||
# Python有三个支持序列化的模块 | ||
# json - JSON / pickle - 二进制 / shelve | ||
import json | ||
import pickle | ||
|
||
|
||
class Student(object): | ||
|
||
def __init__(self, name, age): | ||
self.name = name | ||
self.age = age | ||
|
||
|
||
if __name__ == '__main__': | ||
list1 = [10, 'hello', 99.9, 'goodbye'] | ||
print(json.dumps(list1)) | ||
print(pickle.dumps(list1)) | ||
dict1 = {'name': '骆昊', 'age': 38} | ||
print(json.dumps(dict1)) | ||
print(pickle.dumps(dict1)) | ||
stu = Student('骆昊', 38) | ||
print(pickle.dumps(stu)) | ||
|
22 changes: 22 additions & 0 deletions
22
Day41-55/code/hellodjango/demo/migrations/0005_auto_20180706_1458.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 2.0.6 on 2018-07-06 06:58 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('demo', '0004_auto_20180705_1017'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='teacher', | ||
options={'ordering': ('no',), 'verbose_name': '讲师', 'verbose_name_plural': '讲师'}, | ||
), | ||
migrations.AddField( | ||
model_name='user', | ||
name='counter', | ||
field=models.IntegerField(default=3, verbose_name='票数'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.