tagged [python]
Running Selenium WebDriver Python bindings in Chrome
Running Selenium WebDriver Python bindings in Chrome I ran into a problem while working with Selenium. For my project, I have to use Chrome. However, I can't connect to that browser after launching it...
- Modified
- 23 Feb at 08:57
How can I remove a key from a Python dictionary?
How can I remove a key from a Python dictionary? I want to remove a key from a dictionary if it is present. I currently use this code: Without the `if` statement, the code will raise `KeyError` if the...
- Modified
- 23 Feb at 08:25
How can I Install a Python module within code?
How can I Install a Python module within code? I need to install a package from [PyPI](https://en.wikipedia.org/wiki/Python_Package_Index) straight within my script. Is there maybe some module or `dis...
- Modified
- 23 Feb at 05:30
How to subtract a day from a date?
How to subtract a day from a date? I have a Python [datetime.datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) object. What is the best way to subtract one day?
ImportError: No Module Named bs4 (BeautifulSoup)
ImportError: No Module Named bs4 (BeautifulSoup) I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Py...
- Modified
- 22 Feb at 20:4
Update value of a nested dictionary of varying depth
Update value of a nested dictionary of varying depth I'm looking for a way to update dict `dictionary1` with the contents of dict `update` wihout overwriting `levelA` ``` { "level1": {
- Modified
- 22 Feb at 19:23
Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2) I am using Windows, and I get the error: I think [this](https://stackoverflow.com/questions/2532321/python-importerror-no-mod...
- Modified
- 22 Feb at 16:17
Create new folder with pathlib and write files into it
Create new folder with pathlib and write files into it I'm doing something like this: > Error message: AttributeError: 'NoneType' object has no attribute 'open' Obviously, based on the error message, ...
- Modified
- 22 Feb at 16:16
Convert all strings in a list to integers
Convert all strings in a list to integers How do I convert all strings in a list to integers?
Python: Differentiating between row and column vectors
Python: Differentiating between row and column vectors Is there a good way of differentiating between row and column vectors in numpy? If I was to give one a vector, say: they wouldn't be able to say ...
How do I upgrade to Python 3.6 with Conda?
How do I upgrade to Python 3.6 with Conda? I want to get the latest version of Python to use [f-strings](https://en.wikipedia.org/wiki/Python_(programming_language)#Expressions) in my code. Currently ...
"TypeError: method() takes 1 positional argument but 2 were given" but I only passed one
"TypeError: method() takes 1 positional argument but 2 were given" but I only passed one If I have a class ... ... which I use to create an object ... ... on which I call `method("foo")` like so ... `...
How to stop flask application without using ctrl-c
How to stop flask application without using ctrl-c I want to implement a command which can stop flask application by using flask-script. I have searched the solution for a while. Because the framework...
"ImportError: No module named" when trying to run Python script
"ImportError: No module named" when trying to run Python script I'm trying to run a script that launches, amongst other things, a python script. I get a `ImportError: No module named ...`, however, if...
- Modified
- 20 Feb at 10:43
TypeError: Missing 1 required positional argument: 'self'
TypeError: Missing 1 required positional argument: 'self' I have some code like: But I get an error like: ``` Traceback (most recent call last): File "C:\Users\Dom\Desktop\test\test.py", line 7, in ...
- Modified
- 18 Feb at 20:9
Creating an empty Pandas DataFrame, and then filling it
Creating an empty Pandas DataFrame, and then filling it I'm starting from the pandas DataFrame documentation here: [Introduction to data structures](http://pandas.pydata.org/pandas-docs/stable/dsintro...
Convert integer to string in Python
Convert integer to string in Python How do I convert an integer to a string? --- [How do I parse a string to a float or int?](https://stackoverflow.com/questions/379906/)[floating-point values are not...
Check if a number is a perfect square
Check if a number is a perfect square How could I check if a number is a perfect square? Speed is of no concern, for now, just working. --- [Integer square root in python](https://stackoverflow.com/qu...
- Modified
- 17 Feb at 14:55
Iterate through adjacent pairs of items in a Python list
Iterate through adjacent pairs of items in a Python list Is it possible to iterate a list in the following way in Python (treat this code as pseudocode)? And it should produce
How to build URLs in Python with the standard library?
How to build URLs in Python with the standard library? I need to know how to build URLs in python like: In the python standard library, how would you build a URL?
- Modified
- 16 Feb at 22:12
Calculate Time Difference Between Two Pandas Columns in Hours and Minutes
Calculate Time Difference Between Two Pandas Columns in Hours and Minutes I have two columns, `fromdate` and `todate`, in a dataframe. ``` import pandas as pd data = {'todate': [pd.Timestamp('2014-01-...
- Modified
- 16 Feb at 19:0
Convert list to tuple in Python
Convert list to tuple in Python I'm trying to convert a list to a tuple. Most solutions on Google offer the following code: However, the code results in an error message when I run it: > TypeError: 't...
What does the "yield" keyword do in Python?
What does the "yield" keyword do in Python? What is the use of the `yield` keyword in Python? What does it do? For example, I'm trying to understand this code: ``` def _get_child_candidates(self, dist...
Catching an exception while using a Python 'with' statement
Catching an exception while using a Python 'with' statement I can't figure out how to handle exception for python 'with' statement. If I have a code: I really want to handle 'file not found exception'...
Error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte [https://github.com/affinelayer/pix2pix-tensorflow/tree/master/tools](https://github.com/affinelayer/pi...
- Modified
- 15 Feb at 09:51