引言
虽然用python写过不少脚本了,但总感觉串不起来的样子。整好在github上看到一个100天学python的帖子(https://github.com/jackfrued/Python-100-Days),闲来无事,每天重温一下吧,顺便记录下来。有错误的,欢迎指正啦。
一、print()函数
python3中,print变成了函数。
print('hello, world!')
print("你好,世界!")
print('你好', '世界')
print('hello', 'world', sep=', ', end='!')
print('goodbye, world', end='!\n')
1.print('hello, world!')
print函数里,字符串需要用单引号对,或双引号对,或三引号对括起来。三引号对可以跨行,当然也可以用反斜杠(\)来跨行。
print("hello, world!")
>>>hello, world!
2.print("你好, 世界!")
print函数里,中文字符串输出同英文字符串输出。由于python3字符编码格式已经由python2里的unicode编码集改为pyt