Python教程

Python教程:包含了所有代写案例以及部分答案

  • python根据域名获得ip地址 def getIp(domain): import socket myaddr = socket.getaddrinfo(domain,’http’)[0][4][0] print(myaddr) 其中domain为域名,如 www.sharejs.com,不能带http和url地址 标签:python

    :
  • from email.mime.text import MIMEText import smtplib import getpass msg = MIMEText(‘这是一封来自python的纯文本邮件’,’plain’,’utf-8′) from_addr = ‘发件人邮箱地址’ password = getpass.getpass(‘Password:’) smtp_server = ‘smtp.163.com’ smtp_port = 994 to_addr = ‘收件人邮箱地址*’ se … 继续阅读“Python SMTP 发送纯文本”

    :
  • #!/usr/bin/env python3 """ turtle-example-suite: tdemo_bytedesign.py An example adapted from the example-suite of PythonCard’s turtle graphics. It’s based on an article in BYTE magazine Problem Solving with Logo: Using Turtle Graphics … 继续阅读“python 分形图”

    :
  • #!/usr/bin/env python import sys ”’简单的购物菜单,根据输入的金额,减去选择的商品得到剩下的金额, 一旦省下的金额小于所有的商品价格,提示余额不足”’ product = [] price = [] f = open(‘act.txt’) for line in f.readlines(): p = line.split()[0] pp = line.split()[1] product.append(p) price.append(int(pp)) f.c … 继续阅读“python 购物”

    :