Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ Python maketrans () method     - RHEL7 unattended automatic installation DHCP + TFTP + SYSLINUX + TFTP + Kickstart (Linux)

- Linux gprof oprofiling and performance testing tools (Linux)

- Linux print file and send mail (Linux)

- Linux dynamic libraries and Guide (Programming)

- Learn about EditText little depth (Programming)

- Ganglia Python plug-in the process of writing notes (Linux)

- Source Analysis: Java object memory allocation (Programming)

- Linux SU command security Suggestions (Linux)

- systemd Power Management (Linux)

- MySQL 5.6 Open full query log (Database)

- Close and limit unused ports computer server security protection (Linux)

- Linux vi command list (Linux)

- Examples of Exploration Class File (Programming)

- To install Cinnamon desktop environment on your Ubuntu 14.04 / 12.04 (Linux)

- C ++ Supplements - Virtual Function Principle (Programming)

- Oracle View Object Information (Database)

- Ubuntu 14.04 users how to install VLC 2.2.0 (Linux)

- Linux Network Programming - raw socket instance: MAC Address Scanner (Programming)

- Linux System Getting Started Learning: the local time in between Perl and UNIX timestamp conversion (Linux)

- Formatting Java floating-point types (Programming)

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


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.


maketrans () method syntax:

str.maketrans (intab, outtab)

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

The return value

new string Returns string conversion after generation.


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 !!!

- Iptables Instructions (Linux)
- Preview function to confirm the stop resource Oracle 12c new feature crsctl (Database)
- Vim Getting Started Tutorial (Linux)
- Linux uses a screen recording under RecordMyDesktop (Linux)
- On the PC goes heavy security watch your startup items (Linux)
- openSUSE 13.1 / 13.2 installation SoundConverter 2.1.2 (Linux)
- Use Oracle 11g show spparameter command (Database)
- History and Statistics tuptime use tools to view Linux server system boot time (Server)
- Matters Oracle 11.2 single instance when connecting ASM need to pay attention and deal with the problem (Database)
- Learning how to teach safety system to prevent your own IP leakage (Linux)
- Android recyclerview cardview (Programming)
- Linux formatted partition error Could not stat / dev / sda No such file or directory Solution (Linux)
- VMware 8 installation configuration Win7, CentOS-7 Wizard (Linux)
- Linux server alarms using Java (Server)
- stat Usage: Get permission to file the corresponding figures (Linux)
- To install the iNode client on UbuntuKylin 13.10 (Linux)
- sudoers file parsing (Linux)
- Explore Android SQLite3 multithreading (Programming)
- Linux signal and orphans, and zombie process (Programming)
- About Linux iptables firewall interview questions and answers (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.