Python uses the tkinter module to implement basic GUI, such as button and label. Below is a simple hello WorldProgram, Use python2.4The. py file is as follows:
From tkinter import *From tkmessagebox import *
Def button_click ():Showinfo ('first
After installing python, We can do two things,
1. Copy the python331.chm User Manual under the doc directory in the installation directory to the desktop for your convenience.
2. Add the python installation path c: \ python33 \ To the system
Recently, I strolled around the Forum and participated in two interesting questions about algorithms.
Question 1 is to calculate different characters in any length string and the number of characters.
Question 2 is to output a string in the
I recently started to learn Python and found a better IDE on the Internet. because we used C # For Development and Visual Studio for IDE, we were used to the powerful IDE such as VS, so we had some dependencies on IDE.
There are also a lot of Python
Document directory
Support for Python tail recursion
Support for tail recursion by Node. js
What is tail recursion? Simply put, the final response is just a function call, without the need to save extra local variables.Let's look at a simple
Python uses the variable [header Subscript: tail subscript] to intercept the corresponding string. The subscript starts from 0 and can be a positive or negative number, the subscript can be null, indicating that the header or tail is obtained.
Copy
Function prototype
Declaration: "s" is a string and "rm" is the sequence of characters to be deleted.
S. strip (rm) Delete the characters starting and ending in the s string and located in the rm Delete Sequence
S. lstrip (rm) Delete the
Chapter 1 error handling
Exception parameter: whether the reason contains only one string or a tuples consisting of error numbers and strings, calling str (reason) always returns a readable error cause. this is actually a special method of calling
Chapter 2 syntax and programming style
1. Statements and syntax
A, # (comment), \ n (line break), \ (indicating continued rows),; (two statements on the same line are separated): (separating the line of the title and its subsequent words ),
B. Do
File and input/output
Object
Generic file objects: objects with file-type interfaces, such as files, Web pages, and communications. A file is a continuous byte sequence. Byte streams are often used for data transmission.
Open ():
I found a strange phenomenon yesterday when I saved some Chinese characters to text documents. First look at the Code:
# Coding = utf-8import osdef write_use_open (filepath): try: file = open (filepath, 'wb ') try: content = 'people 'S republic of
For someone from. NET, I am not very comfortable with str and unicode in python. Encoding exceptions are often encountered in some common scenarios. For example, if you want to save a string to text, do you need to encode the string or directly save
In fact, I wanted to write a little code to familiarize myself with the time formatting and display application. But after I typed the code, I found that I only used a little bit of knowledge,
Time. strftime ()
The rest are useless --!, Fortunately,
This time, a function getTime () is added. You can enter a custom date for query.
The Code is as follows:ShowMenuTest. py
1 #-*-coding: UTF-8-*-2 3 def showMenu (): 4 print "Welcome! "5 print" I can tell you everything about time, as long as you
No queue is used, no thread pool is still learning, just Multithreading
Copy codeThe Code is as follows: # coding: utf8
Import urllib2, sys, re
Import threading, OS
Import time, datetime
'''''
The queue is not used here, but the multi-thread
Compared with http, http is characterized by its security. The communication content of http can be captured by a common sniffer, but the content of https is the encrypted content, the value of our use is not very high, so some big websites-websites
Python 2.6 introduces the itertools module to simplify the implementation of arrangement and combination:
Copy codeThe Code is as follows: import itertools
Ordered sorting: e.g., select two of the four numbers:Copy codeThe Code is as follows: >>>
Format summary:
Format
Description
Format
Description
%
Percent sign % mark (the extra % is used as an escape character)
% C
Character and ASCII code
% S
String
% D
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