Questions tagged [python-interactive]
158 questions
0
votes
2 answers
How to store the current state of InteractiveInterpreter Object in a database?
I am trying to build an online Python Shell. I execute commands by creating an instance of InteractiveInterpreter and use the command runcode. For that I need to store the interpreter state in the database so that variables, functions, definitions…

gibraltar
- 1,678
- 4
- 20
- 33
-1
votes
2 answers
When in Python interactive shell, can I copy the previous command to the clipboard?
Is there a command in the interactive shell that copies the last expression to the clipboard?
I know there's the _ command, which repeats the last expression's evaluation, e.g.
>>> " ".join(['a', 'b', 'c'])
'a b c'
>>> _
'a b c'
But what I'm…

Mathieu Dhondt
- 8,405
- 5
- 37
- 58
-1
votes
2 answers
(psuedo) Randomly generated Matrix
I want to create a matrix using the following arrays:
A = [1111,2222,3333]
B = [20,25,26,27]
C = [1.5,2.6,3.7,4.5,5.4,6.7,7.2,8.8,9.0,10.0,11.0,12.2]
Each value in A need to be mapped to all values in be once (each element in A will be attached to…

user6538795
- 3
- 2
-2
votes
1 answer
python __name__ global variable gives different output than expected
I am trying to get a hands-on in python modules.
my code is,
#filename:module.py
def printname():
print __name__
printname()
when I am executing the code with interpreter
python module.py
It gives output(i.e. module name as)
main
and when I…

Premkumar chalmeti
- 800
- 1
- 8
- 23
-2
votes
1 answer
Interactively Re-color Bars in Matplotlib Bar Chart using Confidence Intervals
Trying to shade the bars in this chart based on the confidence that a selected y-value (represented by the red line) lies within a confidence interval. See recolorBars() method in the class example below.
While I understand colormaps, Normalize(),…

Adestin
- 153
- 3
- 15
-2
votes
2 answers
Call the Python interactive interpreter from within a Python script
Is there any way to start up the Python interpreter from within a script , in a manner similar to just using python -i so that the objects/namespace, etc. from the current script are retained? The reason for not using python -i is that the script…

mmirate
- 704
- 6
- 25
-2
votes
3 answers
Handling errors while working with code snippets
I am running a bunch of code all at once in python by copying it from my editor and pasting it into python. This code includes nested for loops. I am doing some web scraping and the program quits at different times. I suspect that this is because…

bill999
- 2,147
- 8
- 51
- 103
-4
votes
1 answer
Problem with python interactive in VSCode
TEMPORAL WORKAROUND: https://www.reddit.com/r/vscode/comments/i45agt/cannot_type_code_into_python_interactive_console/
EDIT: this is a bug in new version of VSCode. There are also a few issues raised on github with the same problem. I will leave the…

pikachu
- 690
- 1
- 6
- 17