Character Converter python

This is a sample of character converter, so lets take that the keyboard is showing my name altin as .ktiv or anything you type in other characters, you just write there .ktiv it tells you that its altin…

#!/usr/bin/python

print '====================================='
print ' Character Converter'

print ' \nThis Script converts characters:\n'

print ' From these: \'1234567890-=qwertyuiop[]`.asdfghjkl;*\\zxcvbnm,\'!@#$%^&()_+NM<L:{]~'
print ' To these: `1234567890-=qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./~!@#$%^&()_+?:"{}|\n'
print ' And also the upper case letters'
print '====================================='
raw_input('Press  to continue\n')

import string

characters = string.maketrans('\'1234567890-=qwertyuiop[]`.asdfghjkl;*\\zxcvbnm,\'!@#$%^&()_+NM<L:{]~QWERTYUIOPASDFGHJK|ZXCVB', '`1234567890-=qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./~!@#$%^&()_+?:"{}|QWERTYUIOPSDFGHJKLXCVBNM')

text = raw_input(' Write text: ').translate(characters)

print '====================================='

print '\nCONVERTION COMPLETE !'
print '\nRESULT: {text}\n'.format(text=text)

print '======='

print 'Do you want to convert more text ?'
yesno = raw_input(' Yes/No: ').lower()

noes = ['no', 'n']
yesses = ['yes', 'y']

if yesno in noes:
     print '           Thank you for using "Character Converter" !'
else:
  text1 = raw_input('\n Write text: ').translate(characters)

  print '====================================='

  print '\nCONVERTION COMPLETE !'
  print '\nRESULT: {text1}\n'.format(text1=text1)

  print '===== Thank you for using "Character Converter" ! =====\n'

raw_input('Press  to exit')

This one is not very Professional but however it did the job I needed,probably it could be done with less code.
BTW I’m sorry for my design with (=) lol.
Here you can find allot more Python Practices I did:
http://www.4shared.com/file/PHCRAFXV/Python_Practices.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s