python基础
基本使用
文本
不设置任何东西
标题
:一级标题(Ctrl+1)
:二级标题(Ctrl+2)
…
#…# (n个#):n级标题(Ctrl+n)
print("Hello")
图片
:[]<路径>
markdown格式路径有三种:
网址
绝对路径
相对路径
举例 ![](<meta http-equiv=‘refresh’
表格
张三 | 1班 | 18 |
---|---|---|
李四 | 2班 | 19 |
王五 | 3班 | 20 |
二麻子 | 4班 | 21 |
姓名|班级|年龄
:-:|:-:|:-:
张三|1班|18
李四|2班|19
环境安装
- 1.python的安装
- 2.pycharm(IDE)/Sublime(轻量型IDE)
- 3.Typora
基础
第一个程序:
print("Hello, World")
三种运行方式
- Python解释器环境下运行;
(D:\Anaconda3) C:\Users\Administrator>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>print("Hello, World")
- 命令窗口中运行脚本
python 文件名.py
```
IDE(Sublime)运行程序
注释
java
//单行注释
/*多行注释*/
/**多行注释*/
Python
- 单行注释
# This is 单行注释
- 多行注释
"""
This is 多行注释
"""
'''
This is 多行注释2
'''
print()输入函数
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
input()输入函数
a=input("请输入信息:")
print("Value of a is:",a)
E:\新建文件夹>Python demo.py
dfdsf
Value of a is: dfdsf
进入指定目录
-
当前目录前。SHIFT+鼠标右键,打开命令窗口(POWERSHELL)
-
按Win+R,输入cmd回车,打开命令窗口。如下:
···input()接收的参数默认返回字符串类型
E:\新建文件夹>Python demo.py
请输入信息:hunsm
Value of a is: hunsm <class 'str'>
E:\新建文件夹>
新内容
数据类型
数据