学习
focus_reality
学习一门编程语言,将结构设计仿真与语言结合起来
展开
-
命令行中运行编辑好的python代码
命令行中运行编辑好的python代码完整目录相对目录完整目录相对目录原创 2019-03-31 19:57:50 · 485 阅读 · 0 评论 -
Performing HTTP requests in Python using urllib
Performing HTTP requests in Python using urllib# Import packagesfrom urllib.request import urlopen, Request# Specify the urlurl = "http://www.datacamp.com/teach/documentation"# This packages th...转载 2019-05-27 22:16:23 · 151 阅读 · 0 评论 -
读取csv文件转换为列表序列
from csv import readerpotus = list(reader(open(‘potus_visitors_2015.csv’)))原创 2019-05-17 21:51:09 · 4509 阅读 · 2 评论 -
Class
An object is an entity that stores data.An object’s class defines specific properties objects of that class will have.转载 2019-05-16 22:07:52 · 111 阅读 · 0 评论 -
apply formatting to numbers using str.format()
![在这里插入图片描述](file:///C:/Users/cheng/Desktop/str_format_v2_1_1.svg)转载 2019-05-16 21:11:14 · 238 阅读 · 0 评论 -
str.format() method
字符串输出name = "Kylie"num = 8output = name + "'s favorite number is " + str(num)print(output)Kylie’s favorite number is 8str.format() method 输出1. The variables are inserted into the {} by the or...转载 2019-05-16 20:45:17 · 217 阅读 · 0 评论 -
frequence table
fruit = ['orange', 'orange', 'orange', 'banana', 'apple', 'banana', 'orange', 'banana', 'apple', 'banana'] fruit_frequency = {}for f in fruit: if f not in fruit_freque...转载 2019-05-16 20:31:08 · 181 阅读 · 0 评论 -
advanve comprehesions
list comprehensions# Create a 5 x 5 matrix using a list of lists: matrixmatrix = [[col for col in range(5)] for row in range(5)]# Print the matrixfor row in matrix: print(row)[0, 1, 2, 3, ...翻译 2019-05-24 22:10:54 · 152 阅读 · 0 评论 -
enumerate and zip
enumerate() returns an enumerate object that produces a sequence of tuples, and each of the tuples is an index-value pair.# Create a list of strings: mutantsmutants = ['charles xavier', ...转载 2019-05-24 21:31:03 · 311 阅读 · 0 评论 -
Count the number of Duplicates
Count the number of DuplicatesWrite a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The inpu...转载 2019-04-26 22:50:56 · 328 阅读 · 0 评论 -
查看python内置范围
import builtinsdir(builtins)原创 2019-05-23 20:00:19 · 137 阅读 · 0 评论