zoukankan      html  css  js  c++  java
  • python day01

    window->perperence里能够看到pydev
    点击“Interpreter - python”->new->添加你的python安装目录下的python.exe
    5.测试
    new->other project->pydev->选择pydev project
    创建工程"HelloPython"
    创建"hello"包
    在__init__.py里输入
    1. print 'Hello python'
     
    执行程序
     
    执行结果:
    end
     
    方式二:在线安装

    首先需要去Eclipse官网下载:http://www.eclipse.org/,Eclipse需要JDK支持,如果Eclipse无法正常运行,请到Java官网下载JDK安装:http://www.oracle.com/technetwork/java/javase/downloads

    打开Eclipse,找到Help菜单栏,进入Install New Software…选项。

    点击work with:输入框的旁边点击Add…,Name可以随便是什么,我输入的是PyDev,Location是http://pydev.org/updates。点击OK。

    等待一下,便可以在选择栏里看到各个选项。

    选择PyDev,然后一路Next,进入安装路径选择界面,使用默认设置,然后 Finish。Eclipse将下载 PyDev,可以从 Eclipse任务栏中看到下载的进度。PyDev安装好后,需要重启Eclipse。


    配置PyDev:

    PyDev安装好之后,需要配置解释器。在 Eclipse 菜单栏中,选择Window > Preferences > Pydev > Interpreter – Python,在此配置 Python。首先需要添加已安装的解释器。如果没有下载安装Python,请到官网下载2.x或者3.x版本:http://www.python.org/

    我使用的是Python3.x版本,Python安装在D:Python32 路径下。单击 New,进入对话框。Interpreter Name可以随便命名,Interpreter Executable选择Python解释器python.exe。

    点击OK后跳出一个有很多复选框的窗口,选择需要加入SYSTEM pythonpath的选项,点击Ok。

    然后在Python Interpreters的窗口,再次点击OK,即完成了Python解释器的配置。

    到此PyDev就已经完成了配置,可以使用Eclipse开始编写Python。


    Hola World:

    在 Eclipse 菜单栏中,选择File > New > Pydev > Project…,在窗口中选择PyDev Project,有三种项目可以创建,选择PyDev Project。

    点击Next,输入项目名,选择相应的项目类型,以及所使用的Python语法版本和Python解释器。

    创建成功后,进入透视图,右击src图标,选择New->Pydev Package,创建一个新的包。系统将自动生成__init__.py 文件,该文件不包含任何内容。再右键单击创建的包,选择 New->Pydev Module,创建你一个新的Python模块,单击Finish。

    这样我们就可以开始创建第一个.py文件了。

    标签: Python

    the_world_is_flat = True if the_world_is_flat : print("hello,baby") print("-----------Numbers") print( (50 - 5*6) / 4) print("-----------variable") width =20 height=5*1 print(width*height); print('apple'); print( 'Py' 'thon'); prefix = 'Py' print( prefix + 'thon'); text = ('Put several strings within parentheses ' 'to have them joined together.') print(text); word = 'Python' print(word[0]+word[-1]); # characters from position 0 (included) to 2 (excluded) print(word[0:2]);# py # character from the beginning to position 2 (excluded print(word[:2]);# py # characters from position 4 (included) to the end print(word[4:]);#on # characters from the second-last (included) to the end print(word[-2:]);#on # the word only has 6 characters #print(word[42]);#string index out of range #array list = [1, 4, 9, 16, 25] print(list[0]+list[-1]) # slicing returns a new list print (list[-3:]); # the following slice returns a new (shallow) copy of the list: print(list[:]); #Lists also support operations like concatenation: print(list + [36, 49, 64, 81, 100]);
  • 相关阅读:
    人工智能第一次作业
    在uni-app的textarea中输入纯数字或者英文不换行的问题
    uni-app实现选择图片上传并显示进度条
    减肥计划
    前端时间格式2020-02-11T12:24:18.000+0000转化成正常格式
    男孩和女孩
    java 获取当前年份 月份 日期
    深海收破烂
    如何爱一个人
    随手心情
  • 原文地址:https://www.cnblogs.com/alamps/p/6471869.html
Copyright © 2011-2022 走看看