1. #coding=utf-8
  2. #Python 3.4 https://docs.python.org/3.4/library/
  3. #IDE:Eclipse +PyDev Window10
  4. import atexit
  5. import os
  6. import sys
  7. import time
  8. import winsound
  9. import code
  10. import codecs
  11. import math
  12. import csv
  13. import base64
  14. import re
  15. import smtplib
  16. from email.mime.text import MIMEText
  17. from email.mime.multipart import MIMEMultipart
  18. from email.header import Header
  19. from email.mime.image import MIMEImage
  20. from email.mime.base import MIMEBase
  21. from email.utils import COMMASPACE, formatdate
  22. import email
  23. import os.path
  24. import mimetypes
  25. import configparser
  26. import string
  27. import nltk
  28. import simhash
  29. import uuid
  30. import socket
  31. import functools
  32. import fnmatch
  33. import time
  34. import datetime
  35. import calendar
  36. import psycopg2
  37. from datetime import timedelta
  38. import random
  39. import unicodedata
  40. from decimal import *
  41. import MailSender #自定义类
  42. import choices #自定义类
  43. from jump import long
  44.  
  45. print("涂聚文,geovindu") #中文显示必需文件编码格式utf-8
  46. #获取本机电脑名
  47. myname = socket.getfqdn(socket.gethostname( ));
  48. #获取本机ip
  49. myaddr = socket.gethostbyname(myname);
  50. print(myname);
  51. print(myaddr);
  52.  
  53. #Data Types
  54.  
  55. print ("hello word 你好,世界");
  56. print (sys.platform);
  57. print (2 ** 100);
  58. #输入
  59. try: userimput = input("输入的内容: ") #PyDev
  60. except NameError: pass
  61. print("你好:"+userimput);
  62. print(type(userimput));#类型
  63. nowTime=time.localtime();
  64. nowDate=datetime.datetime(nowTime[0],nowTime[1],nowTime[2]);
  65.  
  66. datasd=["Acme",50,99.8,"2012-12-21",(2015,12,20)];
  67. productname,productshares,productprice,productdate,productdate2=datasd;
  68. print("产品名称:"+productname);
  69. print("产品数量:"+str(productshares));
  70. print("产品价格:"+str(productprice));
  71. print("产品日期:"+productdate); #datetime.datetime.strptime
  72. date1=datetime.datetime(2015,12,20);
  73. print(type(nowTime)); #time.struct_time
  74. print(type(nowDate)); #atetime.datetime
  75. print(type(productdate2)); #tuple
  76. print(type(productdate)); #str
  77. print(date1);
  78. print(time.strftime("%Y-%m-%d %H:%M:%S",nowTime)); #%Y-%m-%d %H:%M:%S %f
  79. print(nowDate);
  80. #print("time %" % nowDate);
  81. print(time.strptime(productdate,"%Y-%m-%d")); ##字符串转换成time类型 %Y-%m-%d %H:%M:%S
  82. date2=time.strptime(productdate,"%Y-%m-%d");
  83. print(nowDate.strftime("%Y-%m-%d")); ##time类型转换成字符串类型 %y-%m-%d %I:%M:%S %p
  84. print(date2);
  85. print(type(date2));
  86.  
  87. d = timedelta(microseconds=-1);
  88. print(d.days, d.seconds, d.microseconds); # -1 86399 999999
  89. year = timedelta(days=365);
  90. another_year = timedelta(weeks=40, days=84, hours=23,minutes=50, seconds=600); # adds up to 365 days
  91. print(year.total_seconds()); #31536000.0
  92. print(year == another_year);
  93.  
  94. dt = datetime.datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M");
  95. tt = dt.timetuple();
  96. '''
  97. 2006 # year
  98. 11 # month
  99. 21 # day
  100. 16 # hour
  101. 30 # minute
  102. 0 # second
  103. 1 # weekday (0 = Monday)
  104. 325 # number of days since 1st January
  105. -1 # dst - method tzinfo.dst() returned None
  106. '''
  107. for it in tt:
  108. print (it);
  109. ic = dt.isocalendar();
  110.  
  111. '''
  112. 2006 # ISO year
  113. 47 # ISO week
  114. 2 # ISO weekday
  115. '''
  116. for ff in ic:
  117. print(ff);
  118.  
  119. print(calendar.setfirstweekday(calendar.SUNDAY)); #None
  120.  
  121. #https://docs.python.org/3/library/index.html
  122.  
  123. d = Decimal(15.6);
  124. print(d+80);
  125. ra=random.randrange(0,12001,5); # Even integer from 0 to 1200 inclusive 从0至12000,5位数的随机数 11435
  126. print(ra);
  127. mood = choices.PDist([('happy', 0.3), ('neutral', 0.6), ('sad', 0.1)]) #随机选取字符串
  128. print(mood());
  129. rstr=random.choice(["geovindu","du","涂聚文","geovi"]); #随机选取字符串
  130. print(rstr);
  131. deck = 'ace two three four'.split();
  132. random.shuffle(deck); # Shuffle a list 洗牌
  133. print(deck);
  134.  
  135. du=int(2);
  136. print(du*20);
  137. du=long(200);
  138. print(du/20);
  139. du=float(2500.25);
  140. print(du-200);

  

  1. #BitArray 布尔型数组所有的对象类型
  2. #Cubes OLAP 在线分析处理应用程序框架
  3. #Disco 分布式计算所用的mapreduce实现
  4. #Gdata Google数据协议实现
  5. #Hspy Python HDF5文件格式实现
  6. #HDF5 快速I/O 操作所用文件格式 https://pypi.python.org/pypi/h5py
  7. #IPython 交互式开发环境(IDE)
  8. #lxml 用Python处理XML和HTML
  9. #matplotlib
  10. #MPI4Py 消息解析接口(MPI)的并行计算实现
  11. #MPICH2 另一个MPI实现
  12. #numexpr 优化的数值表达式执行
  13. #Pandas 高效处理时间序列数据
  14. #PyTables 使用HDF5的层次化数据库 http://www.pytables.org/ pip install tables http://www.pytables.org/usersguide/installation.html
  15. #
  16. #SciPy 科学函数集合
  17. #Scikit-Learn 机器学习算法
  18. #Spyder Python IDE,具有语法检查,调试和检查功能
  19. #statsmodels 统计模型
  20. #SymPy 符号计算和数学
  21. #Theano 数学表达式编译器
  22. #dateutil
  23. #pyparsing
  24. #libpng
  25. #pytz
  26. #freetype
  27. #cycler
  28. #pyqt
  29. #pygtk
  30. #wxpython
  31. #ffmpeg/avconv or mencoder
  32. #ImageMagick
  33. #Pillow
  34. #pkg-config
  35. #agg
  36.  
  37. #import pyautogui #PyAutoGUI https://pypi.python.org/pypi/PyAutoGUI
  38.  
  39. #使用双连词生成随机文本
  40. sent=['In','the','beginning','god','created','the','heaven','and','the','earth','.'];
  41. mt=nltk.bigrams(sent);
  42.  
  43. for mts in mt:
  44. print(mts);

  http://www.h5py.org/

http://hdf5.net/

http://www.pytables.org/usersguide/installation.html

Anaconda is the leading open data science platform powered by Python

https://www.continuum.io/downloads#windows

Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。

C:\Users\geovindu>conda install scikit-learn
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment C:\Program Files\Anaconda3:

The following packages will be downloaded:

package | build
---------------------------|-----------------
conda-env-2.6.0 | 0 498 B
mkl-2017.0.1 | 0 128.8 MB
numpy-1.11.3 | py35_0 3.4 MB
requests-2.12.4 | py35_0 791 KB
numexpr-2.6.1 | np111py35_2 123 KB
scipy-0.18.1 | np111py35_1 11.6 MB
scikit-learn-0.18.1 | np111py35_1 4.5 MB
pyopenssl-16.2.0 | py35_0 70 KB
conda-4.3.4 | py35_0 534 KB
------------------------------------------------------------
Total: 149.8 MB

The following NEW packages will be INSTALLED:

conda-env: 2.6.0-0 (copy)

The following packages will be UPDATED:

conda: 4.2.9-py35_0 --> 4.3.4-py35_0 (copy)
mkl: 11.3.3-1 --> 2017.0.1-0 (copy)
numexpr: 2.6.1-np111py35_0 --> 2.6.1-np111py35_2 (copy)
numpy: 1.11.1-py35_1 --> 1.11.3-py35_0 (copy)
pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 (copy)
requests: 2.11.1-py35_0 --> 2.12.4-py35_0 (copy)
scikit-learn: 0.17.1-np111py35_1 --> 0.18.1-np111py35_1 (copy)
scipy: 0.18.1-np111py35_0 --> 0.18.1-np111py35_1 (copy)

CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda3
#
# You don't appear to have the necessary permissions to install packages
# into the install area 'C:\Program Files\Anaconda3'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=C:\Program Files\Anaconda3

C:\Users\geovindu>cd..

C:\Users>cd..

C:\>cd C:\Program Files\Anaconda3

C:\Program Files\Anaconda3>conda install scikit-learn
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment C:\Program Files\Anaconda3:

The following packages will be downloaded:

package | build
---------------------------|-----------------
conda-env-2.6.0 | 0 498 B
mkl-2017.0.1 | 0 128.8 MB
numpy-1.11.3 | py35_0 3.4 MB
requests-2.12.4 | py35_0 791 KB
numexpr-2.6.1 | np111py35_2 123 KB
scipy-0.18.1 | np111py35_1 11.6 MB
scikit-learn-0.18.1 | np111py35_1 4.5 MB
pyopenssl-16.2.0 | py35_0 70 KB
conda-4.3.4 | py35_0 534 KB
------------------------------------------------------------
Total: 149.8 MB

The following NEW packages will be INSTALLED:

conda-env: 2.6.0-0 (copy)

The following packages will be UPDATED:

conda: 4.2.9-py35_0 --> 4.3.4-py35_0 (copy)
mkl: 11.3.3-1 --> 2017.0.1-0 (copy)
numexpr: 2.6.1-np111py35_0 --> 2.6.1-np111py35_2 (copy)
numpy: 1.11.1-py35_1 --> 1.11.3-py35_0 (copy)
pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 (copy)
requests: 2.11.1-py35_0 --> 2.12.4-py35_0 (copy)
scikit-learn: 0.17.1-np111py35_1 --> 0.18.1-np111py35_1 (copy)
scipy: 0.18.1-np111py35_0 --> 0.18.1-np111py35_1 (copy)

CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda3
#
# You don't appear to have the necessary permissions to install packages
# into the install area 'C:\Program Files\Anaconda3'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=C:\Program Files\Anaconda3

C:\Program Files\Anaconda3>conda install matplotlib
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment C:\Program Files\Anaconda3:

The following packages will be downloaded:

package | build
---------------------------|-----------------
conda-env-2.6.0 | 0 498 B
requests-2.12.4 | py35_0 791 KB
matplotlib-1.5.3 | np111py35_1 6.2 MB
pyopenssl-16.2.0 | py35_0 70 KB
conda-4.3.4 | py35_0 534 KB
------------------------------------------------------------
Total: 7.6 MB

The following NEW packages will be INSTALLED:

conda-env: 2.6.0-0 (copy)

The following packages will be UPDATED:

conda: 4.2.9-py35_0 --> 4.3.4-py35_0 (copy)
matplotlib: 1.5.3-np111py35_0 --> 1.5.3-np111py35_1 (copy)
pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 (copy)
requests: 2.11.1-py35_0 --> 2.12.4-py35_0 (copy)

CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda3
#
# You don't appear to have the necessary permissions to install packages
# into the install area 'C:\Program Files\Anaconda3'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=C:\Program Files\Anaconda3

C:\Program Files\Anaconda3>conda install nltk
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment C:\Program Files\Anaconda3:

The following packages will be downloaded:

package | build
---------------------------|-----------------
conda-env-2.6.0 | 0 498 B
requests-2.12.4 | py35_0 791 KB
nltk-3.2.2 | py35_0 1.9 MB
pyopenssl-16.2.0 | py35_0 70 KB
conda-4.3.4 | py35_0 534 KB
------------------------------------------------------------
Total: 3.3 MB

The following NEW packages will be INSTALLED:

conda-env: 2.6.0-0 (copy)

The following packages will be UPDATED:

conda: 4.2.9-py35_0 --> 4.3.4-py35_0 (copy)
nltk: 3.2.1-py35_0 --> 3.2.2-py35_0 (copy)
pyopenssl: 16.0.0-py35_0 --> 16.2.0-py35_0 (copy)
requests: 2.11.1-py35_0 --> 2.12.4-py35_0 (copy)

CondaIOError: IO error: Missing write permissions in: C:\Program Files\Anaconda3
#
# You don't appear to have the necessary permissions to install packages
# into the install area 'C:\Program Files\Anaconda3'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=C:\Program Files\Anaconda3

C:\Program Files\Anaconda3>

  1. # -*- coding: utf-8 -*-
  2. """
  3. https://www.continuum.io/downloads#windows 许多库都有基本不用配置
  4. Anaconda3
  5. Spyder Editor
  6.  
  7. Python 3.5
  8.  
  9. C:\Program Files\Anaconda3>
  10.  
  11. This is a temporary script file.
  12. """
  13.  
  14. import sys
  15. import os
  16. import nltk
  17. import matplotlib #标准2D和3D绘图库 https://github.com/matplotlib http://matplotlib.org/users/installing.html
  18. import numpy #强大的数组类及该类上的优化函数
  19. import networkx #构建网络和分析网络模型算法
  20.  
  21. print("geovindu");
  22. print("涂聚文");
  23.  
  24. a=u"geovindu 涂聚文";
  25. b=20.50;
  26. c=["a","b","c"];
  27.  
  28. print(a);
  29. print(b);
  30. for st in c:
  31. print(st);
  32.  
  33. sent=['In','the','beginning','god','created','the','heaven','and','the','earth','.'];
  34. mt=nltk.bigrams(sent);
  35.  
  36. for mts in mt:
  37. print(mts);

  

使用下方法配置开发IDE,减少配置的时间:

1.使用Anaconda 和 Pycharm搭建Python IDE 在Pycharm File->settings->Project **->Project Interpreter->选择Anaconda 自带的python 
2.使用Anaconda 和 Eclipse Java+Pydev搭建Python IDE  在windows->Preferences > Pydev > Interpreter – Python-选择Anaconda 自带的python

python3.4 data type的更多相关文章

  1. PHP 笔记一(systax/variables/echo/print/Data Type)

    PHP stands for "Hypertext Preprocessor" ,it is a server scripting language. What Can PHP D ...

  2. JAVA 1.2(原生数据类型 Primitive Data Type)

    1. Java的数据类型分为2类 >> 原生数据类型(primitive data type) >> 引用数据类型(reference data type) 3. 常量和变量 ...

  3. salesforce 零基础开发入门学习(四)多表关联下的SOQL以及表字段Data type详解

    建立好的数据表在数据库中查看有很多方式,本人目前采用以下两种方式查看数据表. 1.采用schema Builder查看表结构以及多表之间的关联关系,可以登录后点击setup在左侧搜索框输入schema ...

  4. The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

    刚刚有在程序中,传递一个空值至MS SQL Server数据库,这个值的数据类型为DATETIME执行时,它却发生了如标题提示的异常:The conversion of a varchar data ...

  5. XML Data Type Methods(一)

    XML Data Type Methods(一) /*XML Data Type Methods: 1.The query('XQuery') method retrieves(vt.检索,重新得到) ...

  6. include pointers as a primitive data type

    Computer Science An Overview _J. Glenn Brookshear _11th Edition Many modern programming languages in ...

  7. Extended Data Type Properties [AX 2012]

    Extended Data Type Properties [AX 2012] This topic has not yet been rated - Rate this topic Updated: ...

  8. org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String

    org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.Strin ...

  9. Linux C double linked for any data type

    /************************************************************************** * Linux C double linked ...

随机推荐

  1. 使用Windows2003创建FTP服务器 - 进阶者系列 - 学习者系列文章

    现在有不少的FTP建设软件,比如Server-U软件.不过本文只介绍使用Windows2003来创建FTP服务器. 1.  打开控制面板的添加删除程序. 2.  打开 添加删除Windows组件 3. ...

  2. 使用Clean() 去掉由函数自动生成的字符串中的双引号

    有时候由Excel单元格函数軿凑出来的字符串会自带双引号 效果如下: 想这种这个情况,刚好我们軿凑出来的是SQL语句, 执行的时候是去掉双引号, 这时候可以使用Excel自带的函数来去掉双引号 Cle ...

  3. at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)

    最近在做一个WinForm的项目. 使用vs2013开发. 数据库使用的是oracle. 在本地写了一个webservice .测试正常.发布到服务器的时候.就是提示了错误. 打开服务器上的日志.看到 ...

  4. javascript立即调用的函数表达式N种写法(第二篇)

    原文:javascript立即调用的函数表达式N种写法(第二篇) 上一篇博客我谈到将函数声明转换为函数表达式最常见的一种写法是:通过括号()将匿名函数声明转换为函数表达式即(function(){}) ...

  5. knockout笔记

    根据汤姆大叔博客总结-笔记: =============<script type="text/javascript"> $(function () { var View ...

  6. 《剑指Offer》面试题-从头到尾打印链表

    题目描述: 输入一个链表,从尾到头打印链表每个节点的值. 输入: 每个输入文件仅包含一组测试样例.每一组测试案例包含多行,每行一个大于0的整数,代表一个链表的节点.第一行是链表第一个节点的值,依次类推 ...

  7. KMP算法详解-- 转自Matrix67

       6 7 8 9 --    A = a b a b  6 7  7 8 9 --    A = a b a b a  5 6 7  8 9 --    A = a b a b a b  6 7 ...

  8. iOS基础 - 单元测试

    单元测试(unit testing):对软件中最小可测试单元进行检查和验证.一般面向过程的语言中,基本单元为函数,面向对象的语言中,基本单元通常是类,其实对于一个手机上的app来说基本单元也可以是一个 ...

  9. PLAN : 入门题目 ( update )

    更新后 step 1 : A07, A11, A12,A14,A15,A18,A22,A24,A25,A26 A27,A29,A31,A32,A34,A59,A66,A69,A84,B24 B45,B ...

  10. elasticsearch文档-analysis

    elasticsearch文档-analysis   analysis 基本概念 全文搜索引擎会用某种算法对要建索引的文档进行分析, 从文档中提取出若干Token(词元), 这些算法称为Tokeniz ...