Python3.4 data type, python3.4data

Source: Internet
Author: User

Python3.4 data type, python3.4data

# Coding = UTF-8 # Python 3.4 https://docs.python.org/3.4/library/#IDE:Eclipse + PyDev Window10import atexitimport osimport sysimport timeimport winsoundimport codeimport codecsimport mathimport csvimport base64import reimport smtplibfrom email. mime. text import MIMETextfrom email. mime. multipart import MIMEMultipartfrom email. header import Header from email. mime. image import MIMEImagefrom email. mime. base import MIMEBase from email. utils import COMMASPACE, formatdate import emailimport OS. path import mimetypes import configparserimport stringimport nltk import extends uuidimport etimport extends fnmatchimport timeimport datetimeimport calendarimport extends datetime import has specified decimal import * import MailSender # custom class import choices # custom class from jump import longprint ("tu juwen, geovindu ") # UTF-8 # obtain the name of the Local Computer myname = socket. getfqdn (socket. gethostname (); # obtain the local ipmyaddr = socket. gethostbyname (myname); print (myaddr); # Data Typesprint ("hello word, World"); print (sys. platform); print (2 ** 100); # Enter try: userimput = input ("input content:") # pydev1_t NameError: passprint ("Hello:" + userimput ); print (type (userimput); # type nowTime = time. localtime (); nowDate = datetime. datetime (nowTime [0], nowTime [1], nowTime [2]); datasd = ["Acme", 50, 99.8, "2012-12-21", (, 20)]; productname, productshares, productprice, productdate, productdate2 = datasd; print ("Product Name:" + productname); print ("product quantity:" + str (productshares )); print ("product price:" + str (productprice); print ("Product Date:" + productdate); # datetime. datetime. strptimedate1 = datetime. datetime (13712, 20); print (type (nowTime); # time. struct_timeprint (type (nowDate); # atetime. datetimeprint (type (productdate2); # tupleprint (type (productdate); # strprint (date1); print (time. strftime ("% Y-% m-% d % H: % M: % S", nowTime); # % Y-% m-% d % H: % M: % S % fprint (nowDate); # print ("time %" % nowDate); print (time. strptime (productdate, "% Y-% m-% d"); # convert string to time type % Y-% m-% d % H: % M: % Sdate2 = time. strptime (productdate, "% Y-% m-% d"); print (nowDate. strftime ("% Y-% m-% d"); # convert the time type to the string type % y-% m-% d % I: % M: % S % p print (date2); print (type (date2); d = timedelta (microseconds =-1); print (d. days, d. seconds, d. microseconds); #-1 86399 999999 year = timedelta (days = 365); another_year = timedelta (weeks = 40, days = 84, hours = 23, minutes = 50, seconds = 600); # adds up to 365 daysprint (year. total_seconds () ;## 31536000.0 print (year = another_year); dt = datetime. datetime. strptime ("21/11/06 16:30", "% d/% m/% y % H: % M"); tt = dt. timetuple (); ''2006 # year11 # month21 # day16 # hour30 # minute0 # second1 # weekday (0 = Monday) 325 # number of days since 1st January-1 # dst-method tzinfo. dst () returned None ''' for it in tt: print (it); ic = dt. isocalendar (); ''' 2006 # ISO year47 # ISO week2 # ISO weekday ''' for ff in ic: print (ff); print (calendar. setfirstweekday (calendar. SUNDAY); # None # https://docs.python.org/3/library/index.htmld = Decimal (15.6); print (d + 80); ra = random. randrange (1200 random 1, 5); # Even integer from 0 to 11435 random sive Random Number print (ra) from 0 to, 5 digits; mood = choices. PDist ([('Happy ', 0.3), ('neutral', 0.6), ('sad', 0.1)]) # randomly select the string print (mood ()); rstr = random. choice (["geovindu", "du", "tu juwen", "geovi"]); # randomly select the string print (rstr); deck = 'ace two three four '. split (); random. shuffle (deck); # Shuffle a list shuffling print (deck); du = int (2); print (du * 20); du = long (200 ); print (du/20); du = float (2500.25); print (du-200 );

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.