assignment of day four
2024-09-06 06:43:35
目录
1.Numeric type
(1)integer
Use
Is to show people's age;phone number ;id numbers etc.
Define
age_Nick=18 #nick is eighteen years old
print(id(age_Nick))#140733086069536
print(type(age_Nick#<class 'int'>
print(age_Nick)#18
How to use
plus minus,multiply,divide or some logical comparison > <
(2)float
Usefulness
Is to show height weight salary etc.
Define
salary = 2.1 # salary=float(2.1)
print(id(salary))#2188554482512
print(type(salary))#<class 'float'>
print(salary)#2.1
How to use
The same to int plus minus,multiply,divide or some logical comparison > <
2.string type
Use
To show the name ,hobby etc.
Define
name1 = 'Nick'
name2 = "Egg"
print(id(name1))#2039780276080
print(type(name1))#<class 'str'>
print(name1)#Nick
name3 = """Nick
Egg"""
print(name3)#Nick
#Egg
How to use
string type can only plus multiply or logical comparison
3.list
Use
To store multiple value such as multiple girlfriend multiple hobbies .
Define
hobby = 'read'
hobby_list = [hobby, 'run', 'girl']
print(id(hobby_list))#3013323084360
print(type(hobby_list))#<class 'list'>
print(hobby_list)#['read', 'run', 'girl']
How to use
Our aim is not to store but to take I'll show the way to take value from list and plz remenber the start number is 0
4.Dictionary
Use
Is to store many many value from
key value
way ,and while taking can follow the key,key can describe value.
Define
user_info = {'name': 'nick', 'gender': 'male', 'age': 19,
'company_info': ['oldboy', 'shanghai', 50]}
print(id(user_info))#1738629399160
print(type(user_info))#<class 'dict'>
print(user_info)#{'name': 'nick', 'gender': 'male', 'age': 19, 'company_info': ['oldboy', 'shanghai', 50]}
How to use
dictionary taking value is no more rely on indexes,but rely on the key ,though the [key],can get key's value.
4.Wordcloud
import jieba
import wordcloud
# import module
from imageio import imread
mk=imread('wujo.png')
s="蔡徐坤 把 唱 跳 手起刀落 rap 篮球 打成筛子 流量明星 口红 男扮女装 鸡你太美 随后 获得 出道后 首个 个人 音乐类 奖项 亚洲新歌榜 2018 年度盛典“ 最受欢迎 潜力 男歌手"
s_list=jieba.lcut(s)
print(s_list)
s=''.join(s_list)
w=wordcloud.WordCloud(font_path='C:\Windows\Fonts\simsun.ttc',mask=mk,background_color='white')
w.generate(s)
w.to_file('cxk1.png')
最新文章
- MySQL 博客文章目录(2016-08-20更新)
- poj 3630 Phone List
- java强制类型转换
- PHP那些非常有用却鲜有人知的函数
- 提高Linux安全性--hosts.allow, hosts.deny 文件修改方法
- Hadoop插件安装
- AsyncTask測试多任务
- C++STL之双端队列容器
- JDK1.8源码(四)——java.util.Arrays 类
- Python/Django-Web原理(一)
- Java 重入锁 ReentrantLock 原理分析
- SimpleDateFormat 线程不安全及解决方案
- python判断文件是否存在
- html+css+js整体布局——[防止浏览器扩大,界面排版混乱]
- ubuntu创建新用户
- git学习心得
- js 提示条
- java虚拟机的内存划分
- Hadoop生态圈-Flume的主流source源配置
- PrefixSpan
热门文章
- 2019牛客多校第⑨场H Cutting Bamboos(主席树+二分)
- nginx -stream(tcp连接)反向代理配置 实现代理mysql以及文件上传
- python学习笔记:网络请求——urllib模块
- list列表操作(创建、增加、删除、取值)
- layer通过父页面调用子页面的方法及属性
- 【目录】Asp.NETCore轻松学系列
- 初探Remoting双向通信(二)
- texinfo - 软件文档系统
- Eclipse中发布Maven管理的Web项目时找不到类的问题根源和解决办法(转)
- JavaWeb开发之二《JSP&#160;+&#160;Tomcat的第一个程序“Hello&#160;World”》