关于python:phython-第一讲

2次阅读

共计 561 个字符,预计需要花费 2 分钟才能阅读完成。

# 输入语句
# print("hello word")

counter = 100          # 整型变量
miles   = 1000.0       # 浮点型变量
name    = "runoob"     # 字符串

# print (counter)
# print (miles)
# print (name)

'''
python 最具特色的就是应用缩进来示意代码块,不须要应用大括号 {}
'''

# if True:
#     print ("True")
# else:
#     print ("False")
# 数组
total = ['item_one', 'item_two', 'item_three',
        'item_four', 'item_five']
# print(total)
# 字符串
word = '字符串'
sentence = "这是一个句子。"
paragraph = """ 这是一个段落,能够由多行组成 """'''
字符串拼接
print(word+sentence+paragraph)
字符串换行拼接
print(word+'\n'+sentence+'\n'+paragraph)
输入 \n 并且不换行
print(word+'\n'+sentence+r'\n'+paragraph)
'''# input("\n\n 按下 enter 键后退出。")
# 同一行显示多条语句
import sys; x = 'runoob'; sys.stdout.write(x + '\n')
正文完
 0