当前位置: 首页 > news >正文

Python入门教程之安装MyEclipse插件和安装Python环境

为什么80%的码农都做不了架构师?>>> hot3.png

121617_wJt9_1444646.jpg

130908_6m1a_1444646.jpg

http://dlwt.csdn.net/fd.php?i=858467711513251&s=27caceefbe77d6532f648bb5ae3bc048    这个是Python for MyEclipse的插件

http://dlsw.baidu.com/sw-search-sp/soft/6e/17016/python-3.3.5.1418106245.msi   这个是Python for Windows 安装文件





安装好所需要的文件 。即可在MyEclipse里面开始Python最简单的测试了。

首先选择Python的编译器  在MyEclipse Windows-preferences      New

115159_mUQA_1444646.jpg

输入名称


115403_qbML_1444646.jpg

选择编译器

115409_Or9u_1444646.jpg

选择所有的 确认OK  等待一下安装

115734_yuR7_1444646.jpg

完毕之后 就可以开始创建Python工程测试了

选择project

120304_FItI_1444646.jpg

选择Pydev Project 下一步

120541_ZgtU_1444646.jpg

选择个语法版本2.5

120837_wh6p_1444646.jpg

对工程src -NEW -PyDev Module

121014_aOP6_1444646.jpg

新建的后缀名为  .py  自动会切换到PyDev perspective 这个视图下可以更好的编辑。

hello world  代码就一行  比java的少了很多。

121144_ce5s_1444646.jpg


简单的安装和Python代码运行测试就是这样。很简单。都不需要duang duang duang的。

简单的基础运用代码   可以自己试试一下哦。


    2015-03-03 Python 基础知识

'''

@author: 小帅丶
@todo: Python安装使用第一步
Created on 2015-03-03
'''
#coding=utf-8
#Python for String-----------------
str  = "HelloWorld"

print (str);#输出字符串内容
print (str[0]);#索引为0的内容
print (str[2:5]);#索引x到y的内容  包头不包尾
print (str *2);#输出2次内容
print (str + "Test");#输出连接的内容
print ('---------------------------------------------');


#Python for List  -------------------
list  = ['abcd',786,2.23,'john',70.2]
tinylist = [123,'john']

print (list); #输出list
print (list[0]);
print (list[1:3]);
print (list[2:]);#索引2开始 直到最后一个内容输出
print (tinylist*2);
print (list + tinylist);
print ('---------------------------------------------');

#Python for 元组
tuple  = ('abcd',786,2.23,'john',70.2)
#tuple[0] = 'zxs' 元组是不可以修改的  List可以
tinytuple = (123,'john')

print (tuple);#输出元组
print (tuple[0]);
print (tuple[1:3]);
print (tuple[2:]);
print (tinytuple*2);
print (tuple + tinytuple);
print ('---------------------------------------------');

#Python 元字典
dict = {}
dict['one'] = "This is one"
dict[2] = "This is two"
tinydict = {'name':'john','code':6734,'dept':'sales'}#key value的关系

print (dict['one']);#输出键为  one的值
print (dict[2]);#输出键为  2的值
print (tinydict);
print (tinydict.keys()); #输出所有的键
print (tinydict.values());#输出所有的值
print ('---------------------------------------------');



    2015-03-04 Python 基础知识

'''
Created on 2015-3-4

@author: 小帅丶
'''


#Python for 运算
a = 21
b = 10
c = 0

c = a + b
print ("Line 1 - Value of c is ",c);#加法

c = a - b
print ("Line 2 - Value of c is ",c);#减法

c = a * b
print ("Line 3 - Value of c is ",c);#乘法

c = a / b
print ("Line 4 - Value of c is ",c);#除法

c = a % b
print ("Line 5 - Value of c is ",c);#取余

a = 2
b = 5
c = a**b 
print ("Line 6 - Value of c is ",c);#2的5次方

a = 9
b = 2
c = a//b
print ("Line 7 - Value of c is ",c);#取整除
print ("--------------------------");

#Python for 比较运算符
a = 21
b = 10
c = 0
if(a == b):
    print ("Line 1 - a is equal to b");
else:
    print ("Line 1 - a is not equal to b");


if(a != b):
    print ("Line 2 - a is not equal to b");
else:
    print ("Line 2 - a is equal to b");

#if(a <> b):
#    print ("Line 3 - a is not equal to b");
#else:
#    print ("Line 3 - a is equal to b");

if(a < b):
    print ("Line 4 - a is less than b");
else:
    print ("Line 4 - a is not less than b");

if(a > b):
    print ("Line 5 - a is greater than b");
else:
    print ("Line 5 - a is not greater than b");
    
a = 5
b = 20
if(a <= b):
    print ("Line 6 - a is either less than b");
else:
    print ("Line 6 - a is not neither less than not b");

if(b >= a):
    print ("Line 7 - b is either greater than or equal to a");
else:
    print ("Line 7 - b is neither greater than nor equal to a");

print ("--------------Pyhton for 赋值运算符-------------------");

#Pyhton for 赋值运算符
a = 21
b = 10
c = 0
c = a + b
print ("Line 1 - Value of c is ",c);

c += a
print ("Line 2 - Value of c is ",c);

c *= a
print ("Line 3 - Value of c is ",c);

c /= a
print ("Line 4 - Value of c is ",c);

c = 2
c %= a
print ("Line 5 - Value of c is ",c);

c **= a
print ("Line 6 - Value of c is ",c);

c //= a
print ("Line 7 - Value of c is ",c);
print ("-------------Python位运算符----------")

#Python for 位运算符
a = 60 #60 = 0011 1100
b = 13 #13 = 0000 1101
c = 0  
c = a & b #12 = 0000 1100
print ("Line 1 -Value of c is ",c);

c = a | b #61 = 0011 1101
print ("Line 2 -Value of c is ",c);

c = a ^ b #49 = 0011 0001
print ("Line 3 -Value of c is ",c);

c = ~a # -61= 1100 0011
print ("Line 4 -Value of c is ",c);

c = a << 2 #240 = 1111 0000
print ("Line 5 -Value of c is ",c);

c = a >> 2 #15 = 0000 1111
print ("Line 6 -Value of c is ",c);

print ("----------Python逻辑运算符-----------");

#Python for 逻辑运算符
a = 10
b = 20
c = 0

if(a and b):
    print ("Line 1 - a and b are true");
else:
    print ("Line 1 - Either a is not true or b is not true");
    
if(a or b):
    print ("Line 2 - Either a is true or b is true or both are true");
else:
    print ("Line 2 - Neither a is true nor b is true");

a = 0
if(a and b):
    print ("Line 3 - a and b are true");
else:
    print ("Line 3 - Either a is not true or b is not true");
    
if(a or b):
    print ("Line 4 - Either a is true or b is true or both are true");
else:
    print ("Line 4 - Neither a is true nor b is true");

if not(a and b):
    print ("Line 5 - Either a is not true or b is not true or both are not true");
else:
    print ("Line 5 - a and b are true");
print ("---------Python成员运算符----------");
a = 10
b = 20
list = [1,2,3,4,5];
if (a in list):
    print ("Line 1 - a is available in the given list");
else:
    print ("Line 1 - a is not available in the given list");

if(b not in list):
    print ("Line 2 - b is not available in the given list");
else:
    print ("Line 2 - b is available in the given list");
    
a = 2
if(a in list):
    print ("Line 3 - a is available in the given list");
else:
    print ("Line 3 - a is not available in the given list");

print ("---------Python身份运算符--------");
#Python for 身份运算符
a = 20
b = 20
if(a is b):
    print ("Line 1 - a and b have same identity");
else:
    print ("Line 1 - a and b do not have same identity");

if(id(a)==id(b)):
    print ("Line 2 - a and b have same identity");
else:
    print ("Line 2 - a and b do not have same identity");
b = 30
if(a is b):
    print ("Line 3 - a and b have same identity");
else:
    print ("Line 3 - a and b do not have same identity");
    
if(a is not b):
    print ("Line 4 - a and b do not have same identity");
else:
    print ("Line 4 - a and b have same identity");
print("-----------Python运算符优先级-----------");
#Python for 运算符优先级
a = 20
b = 10
c = 15
d = 5
e = 0
e = (a + b) * c / d 
print ("Value of (a+b)*c/d is",e);

e = ((a + b) * c) / d
print ("Value of ((a+b)*c)/d is", e);

e = (a + b) * (c / d);
print ("Vlaue of (a+b)*(c/d) is", e);

e = a + (b * c) / d;
print ("Value of a + (b * c)/d is ", e);
#2015-03-04代码运行结果
Line 1 - Value of c is  31
Line 2 - Value of c is  11
Line 3 - Value of c is  210
Line 4 - Value of c is  2.1
Line 5 - Value of c is  1
Line 6 - Value of c is  32
Line 7 - Value of c is  4
--------------------------
Line 1 - a is not equal to b
Line 2 - a is not equal to b
Line 4 - a is not less than b
Line 5 - a is greater than b
Line 6 - a is either less than b
Line 7 - b is either greater than or equal to a
--------------Pyhton for 赋值运算符-------------------
Line 1 - Value of c is  31
Line 2 - Value of c is  52
Line 3 - Value of c is  1092
Line 4 - Value of c is  52.0
Line 5 - Value of c is  2
Line 6 - Value of c is  2097152
Line 7 - Value of c is  99864
-------------Python位运算符----------
Line 1 -Value of c is  12
Line 2 -Value of c is  61
Line 3 -Value of c is  49
Line 4 -Value of c is  -61
Line 5 -Value of c is  240
Line 6 -Value of c is  15
----------Python逻辑运算符-----------
Line 1 - a and b are true
Line 2 - Either a is true or b is true or both are true
Line 3 - Either a is not true or b is not true
Line 4 - Either a is true or b is true or both are true
Line 5 - Either a is not true or b is not true or both are not true
---------Python成员运算符----------
Line 1 - a is not available in the given list
Line 2 - b is not available in the given list
Line 3 - a is available in the given list
---------Python身份运算符--------
Line 1 - a and b have same identity
Line 2 - a and b have same identity
Line 3 - a and b do not have same identity
Line 4 - a and b do not have same identity
-----------Python运算符优先级-----------
Value of (a+b)*c/d is 90.0
Value of ((a+b)*c)/d is 90.0
Vlaue of (a+b)*(c/d) is 90.0
Value of a + (b * c)/d is  50.0


Python for 数字 2015-03-09

import math
import random
for letter in 'Python':
    if letter =='h':
        pass
        print ('This is pass block');
    print ('Current Letter:',letter);
print ('Good bye!');
print("------Random-----");


a = -10
b = 4.1
x = 1
y = 2
print ("值为:",a,"绝对值为:",abs(a));#返回绝对值
print (math.ceil(b));#向上取整
print (math.exp(1));
print (math.fabs(-10));#返回绝对值
print (math.floor(4.9));#向下取整
print (math.log(4,2));#自然数的对数
print (math.log10(100));#基数为10
print (math.pow(2, 2));
print (round(12.334,2));
print (math.sqrt(4));


print ("随机数",random.choice(range(10)));#指定随机数范围
print (random.randrange(100,1000,1));#开始范围 结束范围 递增基数
random.seed(10)
print (random.random());

list = [20,16,10,5];
random.shuffle(list);
print (list);

print (random.uniform(5,10));
print (math.acos(1));
print (math.asin(1));
print (math.atan(1));
print (math.atan2(5, 5));
print (math.cos(3));
print (math.hypot(3, 2));#sqrt(3*3 +2*2)
print (math.sin(3));
print (math.sin(math.pi/2));
print (math.tan(3));
print (math.tan(math.pi/4));
print (math.degrees(2*math.pi));#弧度转为角度
print (math.degrees(math.pi));
print (math.degrees(math.pi/2));
print (math.degrees(math.pi/4));
print (math.radians(0));
print (math.radians(math.pi));
print (math.radians(math.pi/2));
print (math.radians(math.pi/4));

2015-03-10  code for python

var1 = 'Hello World!';
var2 = 'Python Programming';
print (var1[0]);
print (var2[1:5]);
print ('--------------');
#更新字符串
var1 = 'Hello World'
print (var1[:6]+'Python');
print ('--------------');
#List  
list1 = [123,'xyz',7899]
list2 = [456,'abc']

print (len(list1));
print (len(list2));
print ('--------------');
#List list()
aTuple = (123,'xyz','zara','abc');
aList = list(aTuple);

print (aList);
print ('--------------');
#List append()
aList = [123,'xyz','zara','abc']
aList.append(2009);
print (aList);
print ('--------------');
#List count
aList = [123,'xyz','zara','abc',123]
print (aList.count(123));
print (aList.count('zara'));
print ('--------------');
#List extend
aList = [123,'xyz','zara','abc',123]
bList = [2009,'manni'];
aList.extend(bList);
print (aList);
print ('--------------');
#List index
aList = [123,'xyz','zara','abc']
print (aList.index('xyz'));
print (aList.index('zara'));
print ('--------------');
#List insert
aList = [123,'xyz','zara','abc']
aList.insert(3, 2009);
print (aList);
print ('--------------');
#List pop
aList = [123,'xyz','zara','abc']
print (aList.pop());
print (aList.pop(2));
print ('--------------');
#List remove
aList = [123,'xyz','zara','abc','xyz']
aList.remove('xyz');
print (aList);
aList.remove('abc');
print (aList);
print ('--------------');
#List reverse()
aList = [123,'xyz','zara','abc','xyz']
aList.reverse();
print (aList);
print ('--------------');

#List sort
aList = [123,'xyz','zara','abc','xyz']
aList.sort();
print (aList);
print ('--------------');


转载于:https://my.oschina.net/xshuai/blog/381833

相关文章:

  • Windows系统下类UNIX环境---Cygwin安装
  • MySQL Desc指令相关
  • 一个优秀的软件测试工程师需具备的技能
  • Mozilla正在SpiderMonkey中测试JavaScript并行计算
  • [剑指offer] 二叉树的镜像
  • PHP下用B/S编程模式去实现C/S软件编程模式下的插件引擎功能!
  • Vue创建五:导出及配置文件解析
  • 监测谁用了SQL Server的Tempdb空间
  • JavaScript面向对象程序设计(7): 闭包
  • Java NIO系列教程(十二) Java NIO与IO
  • Session,cookie,localStorage
  • Android拓展系列(12)--使用Gradle发布aar项目到JCenter仓库
  • VsCode编辑器
  • jQuery中的Ajax----05
  • Apache Zeppelin连接Oracle数据库
  • Google 是如何开发 Web 框架的
  • 【编码】-360实习笔试编程题(二)-2016.03.29
  • 【译】React性能工程(下) -- 深入研究React性能调试
  • Android 初级面试者拾遗(前台界面篇)之 Activity 和 Fragment
  • CSS相对定位
  • ES6 学习笔记(一)let,const和解构赋值
  • express + mock 让前后台并行开发
  • MQ框架的比较
  • spring cloud gateway 源码解析(4)跨域问题处理
  • tab.js分享及浏览器兼容性问题汇总
  • 分享一份非常强势的Android面试题
  • 解析 Webpack中import、require、按需加载的执行过程
  • 开源SQL-on-Hadoop系统一览
  • 收藏好这篇,别再只说“数据劫持”了
  • 算法之不定期更新(一)(2018-04-12)
  • 详解NodeJs流之一
  • 用 Swift 编写面向协议的视图
  • 用Visual Studio开发以太坊智能合约
  • d²y/dx²; 偏导数问题 请问f1 f2是什么意思
  • 《天龙八部3D》Unity技术方案揭秘
  • 【运维趟坑回忆录 开篇】初入初创, 一脸懵
  • 如何在招聘中考核.NET架构师
  • 移动端高清、多屏适配方案
  • ###C语言程序设计-----C语言学习(6)#
  • #设计模式#4.6 Flyweight(享元) 对象结构型模式
  • (01)ORB-SLAM2源码无死角解析-(66) BA优化(g2o)→闭环线程:Optimizer::GlobalBundleAdjustemnt→全局优化
  • (day 2)JavaScript学习笔记(基础之变量、常量和注释)
  • (delphi11最新学习资料) Object Pascal 学习笔记---第7章第3节(封装和窗体)
  • (done) 两个矩阵 “相似” 是什么意思?
  • (ISPRS,2023)深度语义-视觉对齐用于zero-shot遥感图像场景分类
  • (Java数据结构)ArrayList
  • (Matalb时序预测)WOA-BP鲸鱼算法优化BP神经网络的多维时序回归预测
  • (附源码)spring boot球鞋文化交流论坛 毕业设计 141436
  • (附源码)计算机毕业设计SSM疫情居家隔离服务系统
  • (十八)devops持续集成开发——使用docker安装部署jenkins流水线服务
  • (转)JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
  • ***微信公众号支付+微信H5支付+微信扫码支付+小程序支付+APP微信支付解决方案总结...
  • . NET自动找可写目录
  • .Net 4.0并行库实用性演练
  • .NET Framework 3.5中序列化成JSON数据及JSON数据的反序列化,以及jQuery的调用JSON