--Notes:

测试环境:Windows ,python 2.7.3,python 自带的IDLE

#-*- coding: utf-8 -*-

# First Lesson
# --- Line syntax ---
# The comment character is "#" ;comments are terminated by end of line.
# Long lines may be continued by ending the line with a backslash(\).

# --- Names and Keywords ---
# Python names(also called identifiers) can be any length and follow these rules:
# 1.The first or only character must be a letter(uppercase or lowercase) or the underbar character,"_".
# 2.Any additional characters may be letters,underbar,or digits.
# 3.Case is significant in Python. The name "Robin" is not the same name as "robin".
#
# The names below are keywords,also known as reserved words.They have special meaning in Python
# and cannot be used as names or identifiers.
#
# and as assert break class continue def del elif else except exec finally for from global
# import if in is lambda not or pass print raise return try with while yield
#

# --- Python's common types ---
# int : 3; long: 3L ; bool: True,False; float : 3.1425
# complex :(3.2+4j) ; str :'string'; unicode :u'Fred';
# list :[] ; tuple:(); dict:{}; bytearray('Bletchley')
# file open('/etc/motd')
#

# To write a long-type constant ,use the same syntax as for int-type constants,
# but place a letter L immediately after the last digit.Also, if an operation on
# int values results in a number too large to reparesent as an int, Python will
# automatically converted it to type long.

#page 16

# --- Methods on Str values ---
##These methods are availabe on any string value S.
##S.capitalize()
##Return S with its first character capitalized(if a letter).
##print 'e e cummings'.capitalize()
##print '2 e 3cummings'.capitalize()
##print 'word in cummings'.capitalize()

##S.center(w)
##Return S centered in a string of width w,padded with spaces.
##If w<=len(S),the result is a copy of S. If the number of padding is
##odd ,the extra space will placed after the centered value.

##print 'x'.center(4)
##print 'x'.center(5)
##print 'capitalize'.center(4)

##S.count(t[,start[,end]])
##Return the number of times string t occurs in S. To search on a
##slice S[start:end] of S,supply start and end arguments.

##print 'banana'.count('a')
##print 'banana'.count('na')
##print 'banana'.count('a',3)
##print 'banana'.count('a',3,5)
##print '中华人民共和国'.count('民')
##print '黄山落叶松叶落山黄'.count('黄')

##S.decode(encoding)
##If S contains an encodedd Unicode String ,this method will return the corresponding
##value as unicode type. The encoding argument specifies which decoder to use;
##typically this will be the string 'utf_8' for the UTF-8 encoding.

##s=u'banana';
##print s.decode('utf-8')
##print s.decode('gbk')
##print s.decode('GBK')

##S.endswith(t[,start[,end]])
##Predicate to test whether S ends with String t.If you supply the optional start
##and end arguments,it tests whether the slice S[start:end] ends with t.

##s='落霞与孤鹜齐飞,秋水共长天一色'
##print s.endswith('秋水')
##print s.endswith('色')
##print s.endswith('一色')
##print s.endswith('秋水共长天一色')
##print s
##print s[1:7]
##print s.endswith('齐飞',1,7)
##s='Python is not su grace!'
##print s
##print s[1:9]
##print s.endswith('is',1,9)
##
##输出:
##False
##True
##True
##True
##落霞与孤鹜齐飞,秋水共长天一色
##惤闇炰
##False
##Python is not su grace!
##ython is
##True

##s.expandtabs([tabsize])
##Returns a copy of s with all tabs repalced by one of more spaces.
##Each tab is interpareted as a request to move to the next "tab stop".
##The optional tabsize argument specifies the number of sapces
##between tab stops;the defualt is 8.

##s.find(t[,satrt[,end]])
##If string t is not found in S,return -1; otherwise return the index of the
##first position in s that matches t.
##The optional start and end arguments restrict the search to slice s[start:end].

##s.index(t[,start[,end]])
##Works like .find(),but if t is not found,it raise a ValueError exception.

##s.isalum()
##predicate that tests whether S is nonempty and all its characters are alphanumeric.
##s.isalpha()
##Predicate that tests whether s is nonempty and all its characters are letters.
##s.isdigit()
##Predicate that tests whether s is nonempty and all its characters are digits.
##s.islower()
##Predicate that tests whether s is nonempty and all its letters are lowercase
##(non-letter characters are ignored).
##s.isspace()
##Predicate that tests whether s is nonempty and all its characters are whitespace characters.
##' \t\n\r'.isspace()
##s.istitle()
##A predicate that tests whether s has "title case".
##s.isupper()
##Predicate that tests whether s is nonempty and all its letters are uppercase letters
##(non-letter cahr-acters are ignored).

s.join(L)
L must be an iterable that produces a sequence of strings.The returned value is a string
containing the members of the sequence with copies of the delimiter string s inserted between them.
s.ljust(w)
Return a copy of s left-justified in a field of width w,padded with spaces.If w<=len(s),
the result is a copy of s.
s.lower()
Returns a copy of S with all uppercase letters replaced by their lowercase equivalent.
s.lstrip([c])
Return s with all leading characters from string c removed.The default value for c is a string
containing all the whitespace characters.

转载于:https://www.cnblogs.com/Alex-Zeng/p/3258860.html

python27读书笔记0.1相关推荐

  1. 《鸟哥Linux私房菜》读书笔记0\1\2\3\4章

    文章目录 一.计算机硬件和Linux的诞生(对应第0.1章): 二.磁盘(对应第2章): 1.MBR--Master Boot Record(过时) 2.GPT--GUID partition tab ...

  2. 计算机组成与设计--软硬件接口 RISC-V版 读书笔记 0

    由于我从网上弄到的是英文版,所以打算硬啃,也当锻炼自己的英文能力了,如果我关于书的理解有什么错误,各位路过的读者欢迎指出 Preface 序言 About this book 关于本书 We beli ...

  3. 【原创】Windows® Embedded CE 6.0 Fundamentals 读书笔记_Chapter 9

    Chapter 9 第九章主要是介绍关于应用程序开发的一章.这一章比较适合应用层开发的人员来了解如何基于wince6.0开发应用层程序,首先我 们还是先看一些单词 //================ ...

  4. 读书笔记程序员的自我修养 0

    读书笔记<<程序员的自我修养>> 0 为什么要读这本书? 可能因为自己是读硬件的缘故,对于编程,我总是尝试的了解各种表象的下面发生了什么事情.而困扰了我的许多问题,在这本书上都 ...

  5. 创业圣经《从0到1》读书笔记精简版(首发虎嗅今日头条)

    这几天刚到手当前炙手可热的来自PayPal创始人Peter Thiel的<Zero to One>,中文名<从0到1>,由高玉芳翻译,中信出版社出版. 本文是我的读书笔记. 第 ...

  6. 《从0到1》读书笔记第4章“竞争意识”第2记:一块猪肉引发的竞争论

    上一篇读书笔记<雾失楼台,月迷津渡>我们提出了让我们"迷失竞争"的观点.那么,对于企业来说,竞争究竟还存在哪些毒害呢?作者Peter Thiel在本第四章中先摆出了两个 ...

  7. 【Effective Objective-C 2.0读书笔记】第六章:块(Blocks)和大中枢派发(GCD)

    继续这本书的读书笔记,希望在其中也加入自己的一些总结,以加深理解.之前这一章写了很多了,保存到草稿箱中,不知道为何丢失了,真是可惜,看来CSDN的MarkDown编辑器还存在一些bugs,在它打上补丁 ...

  8. 《营销5.0后互联网时代的企业战略营销》读书笔记

    文章目录 前言 营销 1.0 到营销 5.0 的发展路径 CIDR 模型 小结 前言 怀着对"营销"继续探索的心情,今年3月份完成了<营销5.0>的阅读,读本书的初衷是 ...

  9. 读书笔记:编写高质量代码--web前端开发修炼之道(二:5章)

    读书笔记:编写高质量代码--web前端开发修炼之道 这本书看得断断续续,不连贯,笔记也是有些马虎了,想了解这本书内容的童鞋可以借鉴我的这篇笔记,希望对大家有帮助. 笔记有点长,所以分为一,二两个部分: ...

最新文章

  1. 冲刺第三天 1.3 THU
  2. go 开了多少个goroutine 怎么看_线上 Go 程序偶尔出现异常怎么办?这个思路可解决你的烦恼...
  3. linux下git修改密码后无法使用,git push后账号密码输出错误和修改
  4. java字节输入与字符输入_Java中的字节输入出流和字符输入输出流
  5. C#数据结构-单链表
  6. 关于lock_guard使用细节
  7. css3缩放 transform: scale() 使用缩放之后顶点对齐问题
  8. ConnectionRead (WrapperRead())Timeout expired
  9. python3----字典
  10. 物联网感知-基于分布式光纤传感的石油石化管道综合监测
  11. 联想笔记本linux驱动,联想为Linux驱动的计算机提供自动固件更新
  12. rh系列服务器上电后按,SV12 RH系列机架服务器操作系统安装.pdf
  13. 7-12 输出大写英文字母 (15 分)
  14. Euler法解微分方程
  15. 学会使用help()
  16. linux命令获取root权限,Linux命令学习:获取root权限
  17. Mac OS 名称问题及修改方法(修改终端中显示的hostname(主机名称) / 电脑名称 / 管理员名称 / LocalHostName(本地主机名称))
  18. DELPHI线程创建与使用
  19. html5 流星,HTML5流星和恒星
  20. win10的c语言程序闪退,Win10专业版软件打不开闪退怎么办?

热门文章

  1. Win10 解决小娜助手占用过高CPU资源问题
  2. 游客丽江住店被蚊子咬醒 前台:养的宠物 死1只赔100
  3. idea 全局查找快捷键
  4. weblogic启动错误 ClassNotFoundException: com.bea.wcp.sip.management.descriptor.beans.SipServerBean
  5. 《三国演义》中死不瞑目的十大风流人物
  6. 数据挖掘实战(1)——手写数字识别
  7. 字典树c语言,字典树的应用 单词意义查找-C语言实现
  8. Linux 挂载4T硬盘到根目录
  9. 苹果cms简介和优点及最新更新地址
  10. C# winform 打印预览