Yesterday turned the hard drive, found a good thing, but I added the password oneself do not remember. Tried a few common didn't try to come out, so wrote a little foot originally for me to try. Oh, still really to solve out.
Python script content
If you are familiar with Java's jsoup package, it should be easy to get started with Python's BeautifulSoup library.
The code is as follows:
#coding: Utf-8Import SysImport UrllibImport Urllib2From BeautifulSoup import BeautifulSoup
The code is as follows:
# Encoding:utf-8
### filenames such as:# down, mp3.##Import Os,re
Fs=os.listdir (' XB ')For f in FS:##### #方法一: partition get useless characters#1. Divide the file name with a ' [' character into 3 parts#ls =f.partition ('
Several basic statements (Print,import, assignment statements) have been described earlier, so let's introduce conditional statements and loop statements.
I. Print and import for more information
1.1 Using a comma output
A. Printing multiple
There is a demand on the line, formatted, from a bunch of s1,s100-s199 to find continuous service and formatted display, such as:
Demon: s106-109,s123,s125
Imperial Sword: s106-109,s123,s125
The code is as follows:
#!/usr/bin/env
The code is as follows:
Import Java.io.BufferedReader;Import Java.io.InputStreamReader;
public class Main {public static void Main (string[] args) {try {System.out.println ("Start");Process PR = runtime.getruntime (). EXEC ("Python test.py");
Look closely at the following two Python programs, the code is identical, but the results are different because the last line return indentation
The code is as follows:
def powersum (Power, *args):
"Return the sum of each argument raised to
The test.conf content of the test configuration file is as follows:
The code is as follows:
[First]W = 2V:3C =11-3
[Second]
Sw=4Test:hello
There are two areas in the test configuration file, first and second, and some spaces and line breaks are
First, the rehabilitation of the ASPThink of ASP Many people will say "ASP language is very egg ache, can't object-oriented, function single, a lot of things can not achieve" and so on. The above is wrong, one of the ASP is not a language is
A count sort instance of Python algorithm learning
The code is as follows:
#-*-Coding:utf-8-*-
def _counting_sort (A, B, K):"" "Count sort, pseudo code as follows:Counting-sort (A, B, K)1 for i←0 to K//Initialize the value of the store2 Do c[i]←03
The ipad goodreader to JS file support is not very good, although can read it but always can't quit, back to the GoodReader main interface, so I need to batch JS file into plain text. For this purpose, I have made the following small application:
The code is as follows:
From Sgmllib import SgmlparserImport Urllib2
Class SGM (Sgmlparser):def reset (self):Sgmlparser.reset (self)Self.srcs=[]Self. Istrue=true
def start_div (Self,artts):For k,v in Artts:If v== "Author":Self. Istrue=falsedef
Beautiful photo!: http://www.beautifulphoto.net/
The code is as follows:
Import Urllib2Import re
_random_url = R ' http://www.beautifulphoto.net/plugin/RndArticle/'_img_patt = Re.compile (R ')
def random (Timeout=3, More=false):Tryhtml =
The code is as follows:
Import OS # # for Os.path.isfile ()
def dealline (line):Print (line) # # I can do a lot of things for line
Def getfilename ():return input (' please input ' file name (input exit () for exit): '). Strip ()
Class more: # #
The code is as follows:
# Compare two strings, if different returns the first one not the same position# If the same returns 0def cmpstr (str1, str2):Col = 0For C1, C2 in Zip (str1, str2):if C1 = = C2:Col + = 1Continueelse:Break#判断是怎样退出循环的, there
First, the relevant code
Database Configuration Class mysqldbconn.py
The code is as follows:
#encoding =utf-8'''Created on 2012-11-12Mysql Conn Connection Class'''Import MySQLdbClass Dbconn:conn = None#建立和数据库系统的连接def connect (self):Self.conn =
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