Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Python maketrans () method     - Batch kill processes using awk command (Linux)

- crontab cause CPU exception Analysis and Processing (Linux)

- Analysis JavaBean (Programming)

- ARM Linux system call (Linux)

- Offline (local) Yum source structures (Linux)

- RedHat Linux 7 build yum source server (Server)

- Copy Recovery using RMAN repository development environment (Database)

- Unsafe reboot start (Linux)

- PostgreSQL log classification and management (Database)

- shell script: a key to install LAMP, LNMP script (Server)

- KVM virtualization of nested virtualization (Linux)

- ORA-00824: can not set sga_target due to existing problem-solving (Database)

- Linux usage in echo (Linux)

- Ubuntu deploying Solr (4.4) to Tomcat (7.0.53) (Server)

- sudo command scenario analysis (Linux)

- Oracle utilized undo data recovery operations (Database)

- Mybatis + binding Struts2: achieving user to insert and find (Programming)

- Testing Oracle 11g RMAN replicate database (Database)

- Java coding conventions (Programming)

- Use LVM partition on Ubuntu and easily adjust the snapshot (Linux)

 
         
  Python maketrans () method
     
  Add Date : 2018-11-21      
         
         
         
 

Description

Python maketrans () method is used to create character mappings conversion table, for taking two parameters, the easiest way is called, the first argument is a string that represents the character to be converted, the second argument is a string indicating that the conversion goal.

NOTE: The two strings must be the same length as a one to one relationship.

Syntax

maketrans () method syntax:

str.maketrans (intab, outtab)

parameter
• intab - string consisting of the string to replace characters. Character string corresponding mapping - outtab;
&bull.

The return value

new string Returns string conversion after generation.

Examples

The following example demonstrates the use of maketrans () method to convert all vowels specified number:

#! / Usr / bin / python

# - * - coding: UTF-8 - * -

from string import maketrans   # maketrans function must be called.

intab = "aeiou"

outtab = "12345"

trantab = maketrans (intab, outtab)

str = "this is string example .... wow !!!"

print str.translate (trantab)

The above examples output results are as follows:
th3s 3s str3ng 2x1mpl2 .... w4w !!!

     
         
         
         
  More:      
 
- Oracle data row split multiple lines (Database)
- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (Linux)
- Python, and / or (Programming)
- Linux script to copy the folder to all folders with the same name (Linux)
- error no.2013 lost connection Tom with SQLServer during query (Database)
- 10 Linux in the passwd command examples (Linux)
- How to make a U disk to install Ubuntu (Linux)
- Use MD5 transform algorithm to prevent exhaustive decipher passwords (Linux)
- Linux common network tools: traceroute routing of scanned (Linux)
- xCAT error Unable to dispatch hierarchical sub-command to NORESOLUTION: 3001 (Linux)
- CentOS 6.0 system security level (Linux)
- How to upgrade to Oracle 11g Oracle 12c (Database)
- Bug tracking library after FastJson omitted the decimal point 0 (Programming)
- Android View event delivery (Programming)
- Installation Eduspec university management systems 17 Linux Mint (Server)
- ImportTsv-HBase data import tool (Database)
- Access.log Apache access log analysis and how to import it into MySQL (Server)
- Thinking in Java study notes - initialization and cleanup (Programming)
- Install the system cleaning software under Linux: BleachBit 1.4 (Linux)
- Joseph Central Java implementation (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.