Commit a06f93a5 authored by Michael Kohlhase's avatar Michael Kohlhase

tweak

parent ea78d920
......@@ -3,16 +3,14 @@
\importmhmodule[repos=MiKoMH/GenCS,path=codes/en/utfcodes]{utfcodes}
\lstset{language=python}
\begin{note}
\begin{omtext}
\begin{nomtext}
Programming with $\unicode$ strings is particularly simple, strings in $\pythonLanguage$
are $\UTFeight$-encoded $\unicode$ strings and all operations on them are
$\unicode$-based\footnote{Older programming languages have $\ASCIIcode$ strings only,
and $\unicode$ strings are supplied by external modules.} This makes the introduction
to $\unicode$ in $\pythonLanguage$ very short, we only have to know how to produce
non-$\ASCIIcode$ characters -- which are on regular keyboards.
\end{omtext}
\end{note}
\end{nomtext}
\begin{frame}[fragile]
\frametitle{Unicode in $\pythonLanguage$}
......@@ -21,17 +19,19 @@
$\UTFeight$.
\item
\begin{omtext}[title=How to write $\unicode$ characters?]
there are four ways
there are five ways
\begin{itemize}
\item write them in your editor\lec{make sure that it uses $\UTFeight$}
\item otherwise use $\pythonLanguage$ escape sequences\lec{try it!}
\begin{lstlisting}
>>> "\N{GREEK CAPITAL LETTER DELTA}" # Using the character name
'\u0394'
>>> "\u0394" # Using a 16-bit hex value
'\u0394'
>>> "\U00000394" # Using a 32-bit hex value
'\u0394'
\begin{lstlisting}
>>> "\xa3" # Using 8-bit hex value
'\u00A3'
>>> "\u00A3" # Using a 16-bit hex value
'\u00A3'
>>> "\U000000A3" # Using a 32-bit hex value
'\u00A3'
>>> "\N{Pound Sign}" # character name
'\u00A3'
\end{lstlisting}
\end{itemize}
\end{omtext}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment