This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import os | |
def url_open(url): | |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'} | |
req = urllib.request.Request(url=url, headers=headers) | |
response = urllib.request.urlopen(req) | |
html = response.read() | |
return html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import urllib.parse | |
import json | |
import time | |
import random | |
while True: | |
content = input("请输入需要翻译的内容(输入q!,退出程序):") | |
if content== "q!" : | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding = "utf--8" | |
import sys | |
import importlib,sys | |
importlib.reload(sys) | |
# sys.setdefaultencoding('utf8') | |
import requests | |
from bs4 import BeautifulSoup as bs | |
import os | |
url = "http://www.mmjpg.com/" | |
headers = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
def callback(): | |
var.set("是我") | |
root = Tk() | |
frame1 = Frame(root) | |
frame2 = Frame(root) | |
var = StringVar() | |
var.set("点击查看") | |
# textLable = Label(root,text = "前方发现美女!") | |
# textLable.pack() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#最简单的处理异常的方式 | |
# try: | |
# x = int(input('Enter the first number:')) | |
# y = int(input('Enter the second number:')) | |
# print(x/y) | |
# except ZeroDivisionError: | |
# print("The second number can't be zero!") | |
#raise可以传递异常 | |
# class MuffledCalculator: | |
# muffled = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
root = Tk() | |
#选项指示说明键 | |
Label(root,text = "作品:").grid(row = 0,column = 0) | |
Label(root,text = "作者:").grid(row = 1,column = 0) | |
v1 = StringVar() | |
v2 = StringVar() | |
#输入框 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
root = Tk() | |
#选项指示说明键 | |
Label(root,text = "作品:").grid(row = 0,column = 0) | |
Label(root,text = "作者:").grid(row = 1,column = 0) | |
#输入框 | |
e1 = Entry(root) | |
e2 = Entry(root) | |
#输入框格式 | |
e1.grid(row = 0,column = 1,padx = 10,pady = 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
master = Tk() | |
def test1(): | |
if e1.get() == "pandy": | |
print("验证通过!") | |
return True | |
else: | |
print("验证失败!") | |
e1.delete(0,END) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
master = Tk() | |
v = StringVar() | |
def test(content,reason,name): | |
if content == "pandy": | |
print("正确!") | |
print(content,reason,name) | |
return True | |
else: | |
print("错误!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
master = Tk() | |
frame = Frame(master) | |
frame.pack(padx = 10,pady =10) | |
v1= StringVar() | |
v2 = StringVar() | |
v3 = StringVar() | |
def test(content): | |
return content.isdigit() |
OlderNewer