Pasting code into the cmdline interpreter
Veek M
vek.m1234 at gmail.com
Thu Sep 22 01:12:01 EDT 2016
I wanted to test this piece of code which is Kate (editor) on the cmd
line python >>> prompt:
tex_matches = re.findall(r'(\\\w+{.+?})|(\\\w+)', msg)
for tex_word in tex_matches:
repl = unicode_tex.tex_to_unicode_map.get(tex_word)
if repl is None:
repl = 'err'
msg = re.sub(re.escape(tex_word), repl, msg)
There are a number of difficulties i encountered.
1. I had to turn on <TAB> highlighting to catch mixed indent (which is a
good thing anyways so this was resolved - not sure how tabs got in
anyhow)
2. Blank lines in my code within the editor are perfectly acceptable for
readability but they act as a block termination on cmd line. So if i
paste:
tex_matches = re.findall(r'(\\\w+{.+?})|(\\\w+)', msg)
for tex_word in tex_matches:
repl = unicode_tex.tex_to_unicode_map.get(tex_word)
if repl is None:
I get:
IndentationError: unexpected indent
How do i deal with this - what's the best way to achieve what I'm trying
to do.
More information about the Python-list
mailing list