Using output variables
Hi,
I just started using PyCharm with Python. I have some code that takes a while to run, and I'd like to run it once and then use the output variables in the console or in another file. How can I do this? It seems that in order to run additional code using the output I need to rerun the entire thing.
Thanks so much!
sonya235
Please sign in to leave a comment.
Hello sophie,
If your code is in a single file, you can select its contents and invoke
the "Execute selection in console" action in the context menu. This will
run a new interpreter, execute your code and leave the interpreter in interactive
mode allowing you to execute other actions.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thanks a lot!
One more question - for some reason indentation in functions is different in the console. For example this won't run:
def no_stopwords(features):
new_features=[]
for word in features:
if word not in stopwords:
new_features.append(word)
print 'stopwords complete'
return new_features
I get an indentation error for 'return new_features'.
If I run this code from the file and not in the console it does run.
What am I doing wrong?
Thank you,
sonya235
Hello sophie,
This seems to be a bug in PyCharm. Please file an issue at http://youtrack.jetbrains.net/
with details.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"