I. File read and write:1. Read the file:Try: f = open (' D:\\1.txt ', ' R ') # reads plain file f = open (' d:\\1.jpg ', ' RB ') # reads binary file f.read () finally: if f:
f.close () with open (' D:\\1.txt ', ' R ') as F: #
Non-abundant Sumsproblem 23A perfect number is a number for which the sum of it proper divisors is exactly equal to the number. For example, the sum of the proper divisors of would be 1 + 2 + 4 + 7 + + =, which means. is a perfect numbe R.A number
Wrote a py script to find the Webshell that the server was left behind.Before the recursive enumeration file, now with the walk function, faster.The biggest change is the regular, looks a lot more presentable.(' [_]{,1}[pp][aa][ss][ss][\w]{,20}= {, 3
1. Enter the root home directory to create the. tab fileThe contents of the. tab file are as follows:##############################################Import sysimport readlineimport rlcompleterimport atexitimport osreadline.parse_and_bind ('
The title is a gimmick ... Actually use the other person's interface, is this goods.Here's the code:#-*-coding:utf-8-*-ImportUrllib,urllib2ImportSYSImportjsonreload (SYS) sys.setdefaultencoding ('Utf-8')
I. Error handling1. Use try: Exception. FinallyTry: print ' Try ... ' r = 10/0 print ' Result: ', R # exception does not print this sentence except Zerodivisionerror, E: # If there is an exception, it will be captured to the C6/>print
The sorting is divided into two kinds, one sort in situ, the other is the copy sort>>> data = [1,4,2,8,9,5,6,0]>>> Data.sort ()>>>>>> data[0, 1, 2, 4, 5, 6, 8, 9]>>> data = [4,66,7,2,7,9,0,5,]>>> data2 = sorted (data)>>>>>> data2[0, 2, 4, 5, 7, 7, 9,
Address: https://github.com/donghouhe/python_fantan_shell_encode/blob/master/netcat_encode.py If you think you can, dot a star to encourage you.This is a primitive order.
1
python - C ' Import Socket,subprocess,os;s = Socket.socket (
In the previous question, if the NX is infinitely larger by itself (or NX = 100), the resulting drawing is divergent. This is because there is an important requirement in the finite difference, the CFL number, in particular, the dependent domain of
ODD Period Square Rootsproblem 64All square roots is periodic when written as continued fractions and can is written in the form:
√ N = a 0 +
1
a1 +
1
a2 +
1
The previous article introduced the Python Application bottle Lightweight framework for Web development, this time introducing cross-domain access issues in the bottle framework.When the current cross-domain access, the data cannot be obtained from
1, first visit http://www.python.org/download/to download the latest version of Python.2, install the download package, all the way next.3, add the installation directory for the computer to the environment variables, add the Python installation
The framework of current Python web development is the most popular, but this article describes a more lightweight web framework: Bottle framework. The theoretical thing is not spoken, directly on the instance code.1. Description of the
The difference between the single quotation mark ', the double quotation mark ", the three quotation mark" "" "" "1, single and double quotation marks are used for a reference to a string, where using double quotation marks when you need to wrap the
An example of implementing a binary algorithm in Python and an example of a python binary algorithm
1. algorithm: (array [low, high])
(1) determine the intermediate position K in the period(2) Compare the searched value T with array [k. If they
Python uses pycurl to monitor http Response Time script sharing and pythonpycurl
Recently, we need to monitor the node to the source station. Simple ping can detect some things, but http request check is also required. So we studied pycurl.
Pycurl
Python capture weather
The program is simple.
Find the data intercepted by the website based on the url.
#!/usr/bin/env pythonimport urllib2import reprovice=raw_input('input you provice')city=raw_input("input city:")url =
Get luogic's daily voice (python)Get luogic's daily voice (python) by Wu xueyingI always like to listen to luogic's thinking, but it's troublesome to order the public account every day, and it's hard to listen for a minute every day. So today I
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.