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

Stella981
• 阅读 466

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

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

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

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

输入名称

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

选择编译器

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

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

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

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

选择project

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

**选择Pydev Project 下一步
**

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

**选择个语法版本2.5
**

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

**对工程src -NEW -PyDev Module
**

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

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

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

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

简单的安装和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 ('--------------');
点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Stella981 Stella981
2年前
AndroidStudio封装SDK的那些事
<divclass"markdown\_views"<!flowchart箭头图标勿删<svgxmlns"http://www.w3.org/2000/svg"style"display:none;"<pathstrokelinecap"round"d"M5,00,2.55,5z"id"raphael
Stella981 Stella981
2年前
Python3:sqlalchemy对mysql数据库操作,非sql语句
Python3:sqlalchemy对mysql数据库操作,非sql语句python3authorlizmdatetime2018020110:00:00coding:utf8'''
Stella981 Stella981
2年前
Python之time模块的时间戳、时间字符串格式化与转换
Python处理时间和时间戳的内置模块就有time,和datetime两个,本文先说time模块。关于时间戳的几个概念时间戳,根据1970年1月1日00:00:00开始按秒计算的偏移量。时间元组(struct_time),包含9个元素。 time.struct_time(tm_y
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
PHP+jQuery寥寥几行代码轻松实现百度搜索那样的无刷新PJAX的分页列表和导航链接
!(https://static.oschina.net/uploads/space/2016/1208/171419_U00R_561214.png)PHP寥寥几行代码轻松实现百度搜索那样的分页列表和导航链接,某些语言的拥趸哭晕在厕所.<?php$apparray('db_prefix''
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这