Python 初体验 基本语法
来源:互联网 发布:在线支付网站源码 编辑:程序博客网 时间:2024/06/03 15:06
初学python,把笔记做一个记录,便于以后使用和查阅
'''Created on 2017年8月3日@author: Administrator1:基础语法'''print('hello world')print("Hello, Python!")# 行和缩进if True: print("True")else: print("False") # 多行语句total = 'item_one ' + \ 'item_two ' + \ 'item_three 'print(total) days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']print(days)# 引号word = 'word'sentence = "这是一个句子。"paragraph = """这是一个段落。包含了多个语句"""# 注释# 第一个注释print("Hello, Python!") # 第二个注释'''这是多行注释,使用单引号。这是多行注释,使用单引号。这是多行注释,使用单引号。'''"""这是多行注释,使用双引号。这是多行注释,使用双引号。这是多行注释,使用双引号。"""# 等待用户输入# str = input("\n\nPress the enter key to exit.")# print("input is "+str)# 同一行显示多条语句,语句之间使用分号(;)分割import sys; x = 'runoob'; sys.stdout.write(x + '\n')# Print 输出# print 默认输出是换行的,如果要实现不换行需要在变量末尾加上逗号:x = "a"y = "b"# 换行输出print(x)print(y)print('---------')# 不换行输出(貌似在这里不起作用)print(x),print(y),print('hello,', end='')print('world!')# 多个语句构成代码组if x=="a": print("x==a")elif x!="a": print("x!=a")# 命令行参数'''$ python -h usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Options and arguments (and corresponding environment variables): -c cmd : program passed in as string (terminates option list) -d : debug output from parser (also PYTHONDEBUG=x) -E : ignore environment variables (such as PYTHONPATH) -h : print this help message and exit '''
阅读全文
0 0
- Python 初体验 基本语法
- Python初接触--基本语法
- java初体验和基本语法问题记录
- Python基本语法
- Python基本语法
- 回顾python基本语法
- Python基本语法1
- 【python】-基本语法
- Python基本语法
- Python基本语法
- python 基本语法
- Python基本语法笔记
- Python基本语法
- Python基本语法
- Python基本语法
- python基本语法
- python基本语法
- python 的基本语法
- js-图片切换实例
- Linux 常用命令记录
- H5页面
- 解决安装MySQL进行写入配置文件时卡住或报错问题
- 我是如何入门Git?
- Python 初体验 基本语法
- Mvp实战心得(二)---Base基类的封装
- C++ Primer Notes
- decode-ways Java code
- 刷题#R9
- Android编译系统参考手册
- 兼容ie8的多文件上传
- [arc082f]Sandglass
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 18: illegal multibyte sequence