There are many Python set functions. The following lists some frequently used functions:
For example, S = set ([1, 2, 3])Some functions can be viewed through Dir (s) and help (s.S. Update (t) uses the element in t to modify s, that is, s now
We need to use the time module to obtain the date in Python, such as the time. strftime method.
Time. strftime ('% Y-% m-% d', time. localtime (Time. Time ()))
Finally, we used the time. strftime () method to format a large string of information
If you do a lot of work on the computer, you finally find that you want to automate some tasks. For example, you may need to search for and replace a large number of text files, or rename and rearrange a bunch of photo files in a complicated way.
Suppose you want to design a module set (that is, a python package) to process audio files and sound data in a unified manner. Normally, their extensions have different sound formats, such as WAV, AIFF, AU ), therefore, you may need to create and
The server I use now is centos release 5.4 (final), but python is still 2.4.3, which is relatively low. I always want to update it. The last time python was forcibly uninstalled, yum and some basic commands could not be used. Therefore, do not
1. yasnippet
2. AutoComplete
3. Rope
PIP install rope
4. pymacs
(1) make install(2) then copy the compiled pymacs. El to the load path.(3) or compile it in bytes:Start Emacs and runM-x byte-compile-file RET pymacs. El RETThis command generates
There are several methods with different effects.
Type factory function, INT (), effect: the floating point number is rounded up, for example, INT (3.5), 3 is returned; the Character Form of a number is converted to a number, such as int ("35 ")
We all know that win7 uses GBK by default, while Ubuntu uses UTF-8 by default. Sometimes ourCodeIt needs to be edited on two platforms, so it is necessary to set up the eclipse encoding. Of course, this is not only used for pydev, but also for
Learning the cultural essence of a language can make you a better person.ProgramIf you have not read the Zen of Python, open the python command prompt and enter import this, you can find an example here for each item in the list.
(Credit:
The built-in Dir () function is used to find out the built-in method of a module. It returns a string list. >>> Import fibo, sys
>>> Dir (fiber)
[
'_ Name __' ,
'Fib' ,
'Fab2' ]
>>> Dir (sys)
[
'_ Displayhook __' ,
'_ Doc __' ,
'_ Thook __' ,
In addition to numeric values, python can operate strings in the following aspects. Enclosed in single or double quotation marks: >>>
'Spam eggs'
'Spam eggs'
>>>
'Doesn
\'
T'
"Doesn' t"
>>>
"Doesn' t"
"Doesn' t"
>>>
'"Yes," he
Sometimes I writeProgramTo use the current time, I want to use python to get the current time. Although it is not very difficult, I always forget to use it once,In order to better remember, I wrote downCurrent Python timeThis articleArticleIf you
If you need to customize an exception, you can derive it from the exception class. In this example, the default _ init _ () exception has been overwritten. >>>
Class Myerror (exception ):
...
Def _ Init _ (self, value ):
... Self. value = Value
...
Http://blog.csdn.net/oldjwu/article/details/4329401 Python reads a row of files each time. Classification: Python Read by 1612 Comment (0) Favorites Report Note that each time Python reads a row of a file, there are two possible methods:
To obtain the dictionary value, we have two methods: dict ['key'] And dict. Get.
Today we will share with you the get () method of the dictionary.
Here we can use a dictionary to make a small game. Assume that the user enters the string "1", "2",
Sometimes, if you want to update or migrate some SQL server data, you can only use the SQL statement to select the entire number of statements. Even the cursor of the advanced point cannot be converted? It's annoying to pick up VS and write a small
You can format the output string using the string format method. For example;>>> Print 'we are the {0} who say "{1 }! "'. Format ('knights', 'ni ')
We are the knights who say "Ni! "
The character (format field) in the brackets is replaced by an
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