Python学习记录-Hello Word

软件安装完毕开始学习写代码啦。

 代码:

 

运行结果:

 

1.开个命令窗口(Windows+R  cmd),打Python 回车

 

2 打quit() 回车

 

3 打  D:回车

md code回车(创建文件夹)

cd code回车(打开文件夹)

4.电脑打开D盘,进入code文件夹,右键新建1.py(可以新建一个文本文档,再更改后缀名)

 

5.用nodepad++打开1.py,输入print(“Hello Word”)

 

 也可以使用这个打开编辑

6.切换到命令窗口打 Python 1.py(1前面时空格)回车

(1.py 文件的第一行设置文件的编码格式

print(“这是中文”),如果出问题了,在1.py最上方插入一行  #-*- coding: utf-8 -*-)

 

7.输入print("这是中文\n"*80)将80改为1000000000会出问题,如下图(后面乘以的数字表示打印的次数)

 

8命令窗口关闭,如何再打开这个位置

Python-quit()-D:-cd code

 

9.1.py

print("Hello Word!")
print("Hello Again")
print("I like typing this.")
print("这是中文\n"*1)
print("This is fun.")
print('Yay!Printing.')
print("I'd much rather you 'not'.")
print('I "said" do not touch this.')

输出:

10.常见命令

 cls 清屏

F3重复上一条命令

format 格式化(不要随便玩,会弄丢文件)

猜你喜欢

转载自www.cnblogs.com/WalkingSnail/p/11239806.html