FAQ Database Discussion Community


Python shell in linux

python,linux,python-idle
Is there a way to have a python IDLE shell, like how it is seen on windows? Sorry if this topic has been raised before, I did not find it. Using Linux mint 17.1 rebecca, Cinnamon 32 bit...

Print vowels in string python

python,python-3.x,python-idle,vowel
Here is my code. I'm not exactly sure if I need a counter for this to work. The answer should be 'iiii'. def eliminate_consonants(x): vowels= ['a','e','i','o','u'] vowels_found = 0 for char in x: if char == vowels: print(char) eliminate_consonants('mississippi') ...

Python: raw_input asks for input once the first time, then twice

python,python-idle
I ran across this old piece of code on my PC: # -*- coding: utf-8 -*- player_pos = 2 def game(): global player_pos background = [2, 1, 2, 1, 2] screen = [0] * 5 for i in range(5): screen[i] = background[i] screen[player_pos] = 7 print screen if raw_input("> ")...

IDLE shutdown when pressing ' [closed]

python,python-idle
I downloaded IDLE to program using Python. But when I try to use a ' create strings, it automatically closes the IDLE. What can I do? Please, help. http://i.stack.imgur.com/MWiwl.jpg...

Python JSON load leads to Error: Connection Forcibly Closed

python,json,python-idle
Overview: I am calling an API with python2.7 using the urllib2 and json libraries. When I run the script I receive the following error if the results count is higher than 20: error: [Errno 10054] An existing connection was forcibly closed by the remote host Script: import json import urllib2...

Python IDLE crash on mac Snow Leopard

python,osx,crash,osx-snow-leopard,python-idle
I have a Mac OS X 10.6 64bit, the problem is simple: When I try to run something on the Python IDLE, it crashes. It crashes also when I try simply to copy/paste something. It's happening with all python versions I've tried: 2.5 2.6 2.7 and 3.3. I avoided this...

Why does returning in Interactive Python print to sys.stdout?

python,return,stdout,python-idle
I ran into something different today. Consider this simple function: def hi(): return 'hi' If I call it in a Python shell, >>> hi() 'hi' >>> print hi() hi It prints out the 'returned' value, even if it's just the repr. This felt odd to me, how could returning be...

Can't make IDLE working on Mac

python,osx,osx-yosemite,python-idle
I have been looking for some answer about this IDLE problem and I tried the suggested solution but nothing worked. I am on OSX yosemite and I want to learn python so I downloaded Python 3.4.3 and the ActiveState Tcl recommended 8.5.17. The problem is that IDLE closes instantaneously without...

Python IDLE : how to run the whole script as it is always stopping at some point

python,python-idle
I created a list, and I offered the user the ability to choose whichever method he would like to run. However when the user selects a number, the if else statements are not being executed. Does anyone know why is that ? I am new to IDLE and python. this...

Script fails with AttributeError when run in CMD, but executes fine in IDLE

python,cmd,python-idle
I am quite new and confused. I tried a simple script with tkinter and it worked fine in IDLE but when i try to launch it from CMD - the tkinter window opens and it looks fine , but when you attempt to click any button or file menu options...

Python Write to Tuple Error with append

python,append,tuples,python-idle
I'm practicing Python 3.3.2 and I would like to practice the append technique to a tuple. I have a text file named user_scores.txt. and it consists of scores from people in my workplace that they have submitted for a mathematical problem. They have submitted different answers that they could...

Can´t use a list with more than one decimal place as input in python

python,windows,list,python-idle
I created an algorithm that organizes a list using sequential search and I am having a problem. I'm using Idle on Windows to program in python (version 3.4.2 ) and this happens: http://i.imgur.com/fbHAHxY.png As you can see(I hope) i tried to create an input with numbers with more than one...

Python Overwrite Dictionary to Text File doesn't work… why?

python,dictionary,interface,buffer,python-idle
I've been previously writing code for a quiz program with a text file that stores all of the participants' results. The code that converts the text file to a dictionary and the text file itself are shown below: Code: import collections from collections import defaultdict scores_guessed = collections.defaultdict(lambda: collections.deque(maxlen=4))...