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
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
import wx | |
def onclick(event): | |
button = event.GetEventObject() | |
label = button.GetLabel() | |
nums = [str(i) for i in range(10)] + ['.', '+', '-', 'x', u'÷'] |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""简单猜测字符串编码并返回 Unicode 字符串 | |
""" | |
def decode_(str_): | |
""" | |
""" | |
text = str_ |
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
def get_next_target(page): | |
start_link = page.find('<a href=') | |
if start_link == -1: | |
return None, 0 | |
start_quote = page.find('"', start_link) | |
end_quote = page.find('"', start_quote + 1) | |
url = page[start_quote + 1:end_quote] | |
return url, end_quote | |
def print_all_links(page): |
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
# Write Python code that assigns to the | |
# variable url a string that is the value | |
# of the first URL that appears in a link | |
# tag in the string page. | |
# page = contents of a web page | |
page =('<div id="top_bin"><div id="top_content" class="width960">' | |
'<div class="udacity float-left"><a href="http://www.xkcd.com">') | |
start_link = page.find('<a href=') | |
start_quote = page.find('"', start_link) |
NewerOlder