hello python!

来源:互联网 发布:剑灵金正恩捏脸数据 编辑:程序博客网 时间:2024/06/05 11:06

hello python!

在编写钱首先下载python程序! 软件下载请到官方网站www.python.org 下载

选择download 选择适合你的应用平台 (大多是windows的用户所以选windows项现在)

运行主程序:IDLE(Python GUI)

然后直接在命令行中 输入 :

print "hello python!"

就可已显示出一个helloworld!,这时 你的第一个python程序就已经完成了

python不需要main函数 所以在做脚本语言中很不错!

下面来完成一个简单的运算

i=1j=2i+j

我们也可以用文本进行编辑 点File-New windows然后程序自动打开一个文本编辑器
i=raw_input()

print"this is "+i

点击Run-run Module

数组元素的相加

字符串与数字相乘


从字符串中查找匹配

方法使用 len() max() min() 

 

分解字符串list("  ") 与替换数组元素number[x,y,z,e,f] 删除元素del number[x]

 

 

#!/usr/bin/env python2# -*- coding: utf-8 -*-#LICENSE: WTFPL#DEPENDS: on this cool font from http://asdasd.rpg.fi/~svo/glasstty/#TODO: port to Python3from time import sleepfrom sys import stdoutanim = ["|", "/", "-", "\\"]while True:    for c in anim:        print "Loading (0 %)", c, "\r",        stdout.flush()        sleep(0.1)