《python简明教程》学习

2017-06-12  本文已影响0人  Michael_zmh

下载地址

str1=r'hello \npython' 
str2='hello \npython'
str3="hello python\n"*2
print str1 # hello \npython
print str2 #   hello
               # python
print str3  #   hello python
                # hello python
s = 'This is a string. \
This continues the string.'
print s
输出:
This is a string. This continues the string.

模块

sys模块


数据结构

元组

元组最通常的用法是用在打印语句中

age = 22
name = 'Michael'
print '%s is %d years old' % (name, age)
输出结果:Michael is22 years old

set

python的set和其他语言类似, 是一个无序不重复元素集, 基本功能包括关系测试和消除重复元素.

引用


面向对象的编程

self

上一篇 下一篇

猜你喜欢

热点阅读