1. In sublime text of the official website to download, is suitable for their own system version. Website address:
2. After installation, open in the menu bar: Preferences--->settings (this is the time to write this, the latest version of the current)
3. After opening we will see such two files, a preferences.sublime-settings--default and a preferences.sublime-settings--user
So this user file is the one we're going to edit.
4. Write the configuration
Python implements two text merges
Work number and name are recorded in the employee fileCopy the Code code as follows:
Cat Employee.txt:
Jason Smith
John Doe
Sanjay Gupta
Ashok Sharma
Record work number and salary in bonus fileCopy the Code code as follows:
Cat Bonus.txt:
100 $5,000
200
300 $3,000
400 $1,250
Request to merge two files and output as follows, processing the result:Copy the Code code as
folder, you need to copy the text and jiebacmd.py, remember that the text needs to be saved as Utf-8 encoding, and then in Cygwin with the CD command to switch the working directory into the new folder, and then enter the following command: Cat Abc.txt|python jiebacmd.py|sort|uniq-c|sort-nr|head-100Code:#encoding =utf-8#usage Example (find top words in Abc.txt):
logarithm comparison.(c) Python implements naive Bayesian classification algorithmIn the Bayesian classifier construction process, the sample sequence with sample size n is often divided into a larger number of training sets and a smaller number of test sets, the training set is used to generate classifiers, test sets are used to test the classifier accuracy rate, this process is called "retained cross-validation." The M sequences in the test set are
1, there is a file, the word between the use of spaces, semicolons, commas, or periods separated, please extract all the words.Solution:use \w to match and extract words, but there is a miscarriage of judgmentUse Str.split to separate character strings, but multiple separators are requiredSeparating strings with Re.splitIn [4]: "Help (Re.split)" Help "on Function" split in module Re:split (pattern, String, maxsplit=0, flags=0) split the source String by the occurrences of the pattern, returning
ObjectivePrevious Selenium2+python Automation 23-Rich Text (auto post) solve the rich text iframe problem, in fact, nothing special, mainly the switch of the IFRAME, this article explains through the JS method to deal with the problem of IFrame on Rich textFirst, load the configuration1. Open the blog Park to write essays, first need to login, here in order to av
ObjectivePrevious Selenium2+python Automation 23-Rich Text (auto post) solve the rich text iframe problem, in fact, nothing special, mainly the switch of the IFRAME, this article explains through the JS method to deal with the problem of IFrame on Rich textFirst, load the configuration1. Open the blog Park to write essays, first need to login, here in order to av
ObjectivePrevious Selenium2+python Automation 23-Rich Text (auto post) solve the rich text iframe problem, in fact, nothing special, mainly the switch of the IFRAME, this article explains through the JS method to deal with the problem of IFrame on Rich textFirst, load the configuration1. Open the blog Park to write essays, first need to login, here in order to av
Shell has many powerful commands, such as awk, sort, and grep. Which of the following statements has higher execution efficiency than php or python? Shell has many powerful commands, such as awk, sort, and grep. Which of the following statements has higher execution efficiency than php or python? Reply: I did a test to analyze dozens of GB of logs every day N years ago. In the Linux environment (Redhat ES 3
Recently wrote a python script that annotated the text with the Tagme API and parsed the returned JSON data. In this process encountered a lot of problems, learned something new, summed up.1. csv file processingA CSV is a formatted file that consists of rows and columns, and the delimiter can vary as needed. Only the delimiter is comma ', ' when it is displayed as a column in Excel.Python's CSV module provi
The example in this article describes how Python transforms text into a picture output. Share to everyone for your reference. The implementation method is as follows:
#-*-coding:utf-8-*-from PIL Import image,imagefont,imagedrawtext = U ' welcome access, http://www.bitsCN.com ' font = Imagefont.truetype ("Msyh.ttf",) lines = []line = ' for word in Text.split (): print word if font.getsize (line+ Word)
Requirements:
To handle a configuration file, take out the available characters to join, the following is the original text, we want to get such a result,
The code is as follows:
Redis-h 127.0.0.1-p 6379 | Select 2Redis-h 127.0.0.1-p 6379 | Select 16Redis-h 127.0.0.1-p 6379 | Select 8
Original text:
The code is as follows:
' Redis_list ' = Array (' normal ' = = Array (' Host ' = ' 10.4.3.125 ',' Port ' =
Python provides two methods for simple text Detection: file header and cchardet library ],
This example describes how to check the text type in Python. We will share this with you for your reference. The details are as follows:
1. According to the file header.
# Whether it is an UTF8 file with BOM header def IsUtf8B
This article describes how to use PyFetion to send text messages in python. For more information, see PyFetion. you can easily use python to send text messages using Fetion. the following code is provided:
The code is as follows:
From fetion import *Import OSDef SendSMS (sms ):Myphone = 'xxxxxx'Mypwd = 'oooooooooo
Scene:Python first reads a text file named Log.txt, which contains the filename relative to the path information filename.Python then calls Shutil.copy2 (SRC, DST) to copy the filename file.Because filename is relative path information, we need to write hard-coded to the parent directory, assuming "c:\\ source directory \ \", as well as the target directory information, assuming "c:\\ target directory \ \".Code:ImportShutildefget_file_list (SRC): F= O
python text string-by- character reversal and word-wise reversal Scene: String-by-character reversal and word-wise reversal first, the string is reversed by character-by-word, python provides a very useful slice, so you just need a sentence to get it done. >>>a=' abc EDF DEGD ' >>>a[::-1] ' dged fde CBA ' >>> And then we look at the word reversal. 1. Similarly,
python text Stitching, merging strings Scene: Stitching, merging strings In this scenario, the first thing we think of is the use of the + or += Connect two strings together >>>a=' A ' >>>b=' B ' >>>c=a+b >>>C ' AB ' >>> If the entire program only has two strings to stitch, that's fine. However, if there is a large number of splicing in the program, and even need to loop stitching, this time the
Warehouse Address: Https://github.com/RobinDavid/PytesserInstall tesseract sudo Install Opencv-pythonAfter installation, you need to download the identification file, because my environment isTesseract 3.02.02leptonica-1.70Zlib 1.2.11So I downloaded 3.02 of the Chinese recognition training data, the address ishttps://sourceforge.net/projects/tesseract-ocr-alt/files/Need to extract to/usr/local/share/tessdataThen write the script test.pyImport= pytesser.image_file_to_string ("./test.png","chi_ Si
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.