tagged [python-3.x]
Generate a random letter in Python
Generate a random letter in Python Is there a way to generate random letters in Python (like random.randint but for letters)? The range functionality of random.randint would be nice but having a gener...
- Modified
- 17 Jun at 13:39
Is there a ceiling equivalent of // operator in Python?
Is there a ceiling equivalent of // operator in Python? I found out about the `//` operator in Python which in Python 3 does division with floor. Is there an operator which divides with ceil instead? ...
- Modified
- 2 Jul at 12:59
TypeError: worker() takes 0 positional arguments but 1 was given
TypeError: worker() takes 0 positional arguments but 1 was given I'm trying to implement a subclass and it throws the error: `TypeError: worker() takes 0 positional arguments but 1 was given` ``` clas...
- Modified
- 19 Sep at 01:23
What does "SyntaxError: Missing parentheses in call to 'print'" mean in Python?
What does "SyntaxError: Missing parentheses in call to 'print'" mean in Python? When I try to use a `print` statement in Python, it gives me this error: What does that mean?
- Modified
- 5 Jun at 16:27
python mpl_toolkits installation issue
python mpl_toolkits installation issue After command `pip install mpl_toolkits` I receive next error: > Could not find a version that satisfies the requirement mpl_toolkits (from versions: )No matchin...
- Modified
- 28 Dec at 02:24
How to upgrade Python version to 3.7?
How to upgrade Python version to 3.7? I have python3.5 already in linux ubuntu. I have downloaded the python3.7.tar [www.python.org](http://www.python.org). But i have no idea how to install it. How t...
- Modified
- 11 Jul at 07:40
EOFError: EOF when reading a line
EOFError: EOF when reading a line I am trying to define a function to make the perimeter of a rectangle. Here is the code: I think I haven't left any arguments opened or anything like that.
- Modified
- 16 Jul at 11:56
Extract Number from String in Python
Extract Number from String in Python I am new to `Python` and I have a String, I want to extract the numbers from the string. For example: Output is `['4', '3']` I want to get `3158` only, as an Integ...
- Modified
- 2 Nov at 18:11
How can I specify the function type in my type hints?
How can I specify the function type in my type hints? How can I specify the type hint of a variable as a ? There is no `typing.Function`, and I could not find anything in the relevant PEP, [PEP 483](h...
- Modified
- 14 Sep at 10:39
pip install returning invalid syntax
pip install returning invalid syntax I've just installed python 3.6 which comes with pip However, in Windows command prompt, when I do: 'pip install bs4' it returns 'SyntaxError: invalid syntax' under...
- Modified
- 4 Dec at 12:11
How to print a list with integers without the brackets, commas and no quotes?
How to print a list with integers without the brackets, commas and no quotes? This is a list of Integers and this is how they are printing: I want them to simply print like this: I don't want brackets...
- Modified
- 15 Sep at 18:22
How to print an exception in Python 3?
How to print an exception in Python 3? Right now, I catch the exception in the `except Exception:` clause, and do `print(exception)`. The result provides no information since it always prints ``. I kn...
- Modified
- 19 Nov at 22:49
Python, HTTPS GET with basic authentication
Python, HTTPS GET with basic authentication Im trying to do a HTTPS GET with basic authentication using python. Im very new to python and the guides seem to use diffrent librarys to do things. (http.c...
- Modified
- 9 Aug at 16:31
How to get tkinter canvas to dynamically resize to window width?
How to get tkinter canvas to dynamically resize to window width? I need to get a canvas in tkinter to set its width to the width of the window, and then dynamically re-size the canvas when the user ma...
- Modified
- 15 Mar at 01:4
How to fix "could not find or load the Qt platform plugin windows" while using Matplotlib in PyCharm
How to fix "could not find or load the Qt platform plugin windows" while using Matplotlib in PyCharm I am getting the error "could not find or load the Qt platform plugin windows" while using matplotl...
- Modified
- 11 Jun at 16:55
Integer division in Python 2 and Python 3
Integer division in Python 2 and Python 3 How can I divide two numbers in Python 2.7 and get the result with decimals? I don't get it why there is difference: in Python 3: in Python 2: Isn't this a mo...
- Modified
- 20 May at 10:7
Modifying a variable in a module imported using from ... import *
Modifying a variable in a module imported using from ... import * Consider the following code: As it seems, this creates one variable in each module with different content. How can I modify the variab...
- Modified
- 13 Sep at 20:6
How to fix AttributeError: partially initialized module?
How to fix AttributeError: partially initialized module? I am trying to run my script but keep getting this error: How can I fix it?
- Modified
- 4 Jan at 14:9
Updating Python on Mac
Updating Python on Mac I wanted to update my python 2.6.1 to 3.x on mac but I was wondering if it's possible to do it using the terminal or I have to download the installer from python website? I am a...
- Modified
- 22 Jul at 21:13
How to add an element to the beginning of an OrderedDict?
How to add an element to the beginning of an OrderedDict? I have this: If I do this: Then I get this: but I want this: without creating new dictionary.
- Modified
- 11 Dec at 10:7
How to specify multiple return types using type-hints
How to specify multiple return types using type-hints I have a function in python that can either return a `bool` or a `list`. Is there a way to specify the return types using type hints? For example,...
- Modified
- 6 Oct at 12:58
How to upgrade pip3?
How to upgrade pip3? I want to use python3.5 for development, but many times when I install the module for python 3.5, it always fails. The terminal tells me that a higher version is available, but it...
- Modified
- 24 Feb at 22:30
Best way to convert string to bytes in Python 3?
Best way to convert string to bytes in Python 3? [TypeError: 'str' does not support the buffer interface](https://stackoverflow.com/questions/5471158/typeerror-str-does-not-support-the-buffer-interfac...
- Modified
- 29 Mar at 12:26
Error when executing `jupyter notebook` (No such file or directory)
Error when executing `jupyter notebook` (No such file or directory) When I execute `jupyter notebook` in my virtual environment in Arch Linux, the following error occurred. `Error executing Jupyter co...
- Modified
- 14 Jul at 02:8
how to exit a python script in an if statement
how to exit a python script in an if statement I'm using Python 3.2 and trying to exit it after the user inputs that they don't want to continue, is there code that will exit it in an if statement ins...
- Modified
- 18 Jun at 22:7