python
aaaaamater
这个作者很懒,什么都没留下…
展开
-
print 格式化输出
1.字符串print('%s' %'hello world')hello world2.整数print('%d' %234)234print('%d' %234.7)234print('%d' %round(234.7))2353.浮点数print('%f' %round(234.7))235.000000print('%f.2' %round(234.7))235.004.占位符宽度p原创 2017-10-27 17:25:58 · 1708 阅读 · 0 评论 -
《编程实践》chapter2
chapter 数据结构2.1 intA%B=C C符号与B相同 若A,B,一正一负,C=|A|-(|B|*(int(|A|/|B|)+1)) 若A,B,同号,C=A-B*(A/B)17/10 #1.717%10 #7 取模运算17/-10 #1.717%-10 #-3 17-(10*|1.7|)=17-20 有一个除数时-17%10 #3 运算方法等原创 2017-10-28 13:24:07 · 169 阅读 · 0 评论 -
《编程实践》chapter3字符串
字符串3.1'Albert' 'Einstein' #'AlbertEinstein' +'Albert ' 'Einstein' #'Albert Einstein' +'Albert' ' Einstein' #'Albert Einstein' +A='hello'A[0:3] #'hel'3.2 字符串运算 操作符 表达式 + ‘abc’+’def’ #’转载 2017-10-28 14:39:19 · 229 阅读 · 0 评论