tagged [python]
Convert set to string and vice versa
Convert set to string and vice versa Set to string. Obvious: String to set? Maybe like this? Extremely ugly. Is there better way to serialize/deserialize sets?
- Modified
- 4 Dec at 17:23
How to get PID by process name?
How to get PID by process name? Is there any way I can get the PID by process name in Python? For example I need to get `3110` by `chrome`.
- Modified
- 7 Jan at 20:11
Automatically create requirements.txt
Automatically create requirements.txt Sometimes I download the python source code from `github` and don't know how to install all the dependencies. If there is no `requirements.txt` file I have to cre...
- Modified
- 10 Jun at 11:22
Python datetime strptime() and strftime(): how to preserve the timezone information
Python datetime strptime() and strftime(): how to preserve the timezone information See the following code: the output is ``` 2013-02-07 17:42:31 EST 2
- Modified
- 22 Jul at 21:49
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
'NoneType' object is not subscriptable?
'NoneType' object is not subscriptable? This code is returning the "'NoneType' object is not subscriptable" error when I try and run ``` printer(MASTERLIS
- Modified
- 6 Nov at 13:56
Why do I get a NameError when using input()?
Why do I get a NameError when using input()? I am getting an error executing this code: The error message is What's going on?
- Modified
- 16 Aug at 23:1
pandas: find percentile stats of a given column
pandas: find percentile stats of a given column I have a pandas data frame my_df, where I can find the mean(), median(), mode() of a given column: I am wondering is it possible to find more detailed s...
- Modified
- 28 Jun at 01:26
Relative imports - ModuleNotFoundError: No module named x
Relative imports - ModuleNotFoundError: No module named x This is the first time I've really sat down and tried python 3, and seem to be failing miserably. I have the following two files: 1. test.py 2...
- Modified
- 27 Jun at 03:29
How to merge a transparent png image with another image using PIL
How to merge a transparent png image with another image using PIL I have a transparent png image `foo.png` and I've opened another image with: Now what I need is to merge `foo.png` with `foo2.png`. (`...
- Modified
- 8 Oct at 20:57
How do I return dictionary keys as a list in Python?
How do I return dictionary keys as a list in Python? With Python 2.7, I can get dictionary , , or as a `list`: With Python >= 3.3, I get: How do I get a plain `list` of keys with Python 3?
- Modified
- 27 Feb at 21:29
how to run python files in windows command prompt?
how to run python files in windows command prompt? I want to run a python file in my command prompt but it does nothing. These are the screen shots of my program i am testing with and the output the c...
- Modified
- 13 Sep at 05:19
How to get the current working directory using python 3?
How to get the current working directory using python 3? When I run the following script in IDLE I get output as but when I run from cmd prompt, I get How do I get same result which I got using IDLE ?
- Modified
- 9 May at 13:4
No module named 'pymysql'
No module named 'pymysql' I'm trying to use PyMySQL on Ubuntu. I've installed `pymysql` using both `pip` and `pip3` but every time I use `import pymysql`, it returns `ImportError: No module named 'pym...
- Modified
- 31 Oct at 00:42
how to install tensorflow on anaconda python 3.6
how to install tensorflow on anaconda python 3.6 I installed the new version python 3.6 with the anaconda package. However i am not able to install tensorflow. Always receive the error that tensorflow...
- Modified
- 7 Nov at 13:28
Can't instantiate abstract class with abstract methods
Can't instantiate abstract class with abstract methods I'm working on a kind of lib, and I'm getting an error. - [Here](https://github.com/josuebrunel/yahoo-fantasy-sport/blob/master/fantasy_sport/ros...
- Modified
- 22 Dec at 09:34
How to set Python3.5.2 as default Python version on CentOS?
How to set Python3.5.2 as default Python version on CentOS? Is there a way to set the Python 3.5.2 as the default Python version on CentOS 7? currently, I have Python 2.7 installed as default and Pyth...
- Modified
- 23 May at 16:1
how to add json library
how to add json library i am new to python, on my Mac, when i issue command I get error on json. how to add this library? i'm using 2.5 (the default came with leopard)
- Modified
- 7 Sep at 14:34
How to set the timezone in Django
How to set the timezone in Django In my django project's `settings.py` file, I have this line : But I want my app to run in UTC+2 timezone, so I changed it to It gives the error `ValueError: Incorrect...
- Modified
- 29 Aug at 20:22
TypeError: unsupported operand type(s) for -: 'str' and 'int'
TypeError: unsupported operand type(s) for -: 'str' and 'int' How come I'm getting this error? My code: Error:
- Modified
- 4 Jan at 08:55
Why does Python give the "wrong" answer for square root? What is integer division in Python 2?
Why does Python give the "wrong" answer for square root? What is integer division in Python 2? I know I can `import math` and use `sqrt`, but I'm looking for an answer to the above. What is integer di...
- Modified
- 30 Jan at 01:20
Python: download a file from an FTP server
Python: download a file from an FTP server I'm trying to download some public data files. I screenscrape to get the links to the files, which all look something like this: I can't find any documentati...
- Modified
- 7 Apr at 11:14
How to check if a result set is empty?
How to check if a result set is empty? I have a sql statement that returns no hits. For example, `'select * from TAB where 1 = 2'`. I want to check how many rows are returned, Here I get already excep...
- Modified
- 1 Mar at 08:4
Why doesn't requests.get() return? What is the default timeout that requests.get() uses?
Why doesn't requests.get() return? What is the default timeout that requests.get() uses? In my script, `requests.get` never returns: What could be the possible reason(s)? Any remedy? What is the defau...
- Modified
- 23 Jun at 10:17
Unsupported operation :not writeable python
Unsupported operation :not writeable python Email validation I am wondering why my data wont write to the disk. Python says that my operation is not supported. ``` is_e
- Modified
- 24 Apr at 16:15