一、使用IDEA创建Python项目
文件-新建-项目,语言选择Python,等待python解释器安装成功后即可
二、Python语法基础
python
import subprocess
subprocess.run("dir",shell=True,encoding='utf8')
print("hello")
name = "zhangsan"
#name: zhangsan
print(f"name: {name}")
#zhangsan
print(name)
name2 = "zhangsann"
#False
print(name == name2)
#从外部输入
high = input("please input high:")
print(f"high: {high}")
#False
print("A" == 65)
print("A"+"1")
#读取外部文件内容
try:
with open("firsttxt.txt","r",encoding='utf-8') as f:
content = f.read()
print(content)
except FileNotFoundError:
print("file not found")
finally:
print("try end")
#条件判断
if 8 == 10:
print(等于)
else:
print("不等于")
#循环
for i in {1,2,3,4}:
print(i)