{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h1 align=\"center\">String module</h1>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import string\n",
    "\n",
    "print(string.ascii_letters)\n",
    "print(string.ascii_lowercase)\n",
    "print(string.ascii_uppercase)\n",
    "print(string.hexdigits)\n",
    "print(string.digits)\n",
    "print(string.octdigits)\n",
    "print(string.punctuation)\n",
    "print(string.printable[: 94])\n",
    "print(ascii(string.printable[94: ]))\n",
    "print(ascii(string.whitespace))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from string import capwords\n",
    "\n",
    "print(capwords(' \\n\\n \\tA ABC AbC   aBc AB-CD  a123,  A_$#   a*12 1abc _ab  \\t\\n '))\n",
    "print(capwords(' \\n\\n \\tA_*_ABC  _*_ AbC   aBc _*_AB-CD  a123,_*_A_$#  \\t\\n ', sep = '_*_'))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}

Resource created Wednesday 19 August 2015, 10:06:14 AM.

file: string_module.ipynb


Back to top

COMP9021 15s2 (Principles of Programming) is powered by WebCMS3
CRICOS Provider No. 00098G