0
votes
2answers
15 views
Manual replace in dict python
Example:
a = [1,2,3,2,4,2,5]
for key in a:
if key == 2:
key = 10
print key
Result: [1,10,3,10,4,10,5]
I need Python to "ask" manualy which of the elements to replace.
0
votes
0answers
8 views
How to configure Python Kivy for PyCharm on Windows?
I'm having trouble getting Kivy to work with PyCharm on Windows 7. I've managed to add most of the external libraries through File > Settings > Python interpreters > Paths Tab.
I'm using the Kivy ...
1
vote
2answers
48 views
python regex and replace
I am trying to learn python and regex at the same time and I am having some trouble in finding how to match till end of string and make a replacement on the fly.
So, I have a string like so:
...
0
votes
1answer
16 views
Python 2.7 - IPython 'raw_input' and appending to a list - adds 'u' before each item
I'm using Python 2.7 on Mac OSX Lion. I'm using IPython with the Pandas 0.11.0, Numpy and Statsmodels packages.
I'm writing a function that allows the user to do logistic regression on a file, ...
2
votes
1answer
31 views
Python dateutil parser, ignore non-date part of string
I am using dateutil to parse picture filenames and sort them according to date. Since not all my pictures have metadata, dateutil is trying to guess where to put them.
Most of my pictures are in ...
0
votes
1answer
14 views
How to change tornado post header and add into header new data?
I have handler which handles post request and returns some JSON to client, before I return I need to validate input data, if data doesn't pass validation I need to put in header ( I don't know how to ...
0
votes
0answers
21 views
nessus scan from cronjob giving error,but not from bash.?
I am trying to run a nessus scan from cronjob by subprocess python module. ,but from cronjob it's is giving an error. But not giving any error on execution of script from bash?
the cronjob code
01 ...
0
votes
3answers
87 views
Setting up Python for web development on Windows [closed]
What is the easiest way to set Python 2.7 (and Django) up for web development under Windows 7 (64-bit) with Apache and MySQL?
I know I have to install Apache, MySQL, Python 2.7, Django and mod_wsgi, ...
-1
votes
1answer
37 views
TypeError: 'NoneType' object is not callable when creating an instance of object
Hi next thing is bothering me:
I'm trying to use the next class:
class GameStatus(object):
"""Enum of possible Game statuses."""
__init__ = None
NotStarted, InProgress, Win, Lose = range(4)
def ...
0
votes
0answers
24 views
Pycharm : how-to launch for a standard terminal (to solve an issue with curses)
I'm facing a weird problem.
Using Pycharm (please do not troll about this fact), I'm trying to launch a short app that uses ncurses to render some things on my term.
While I can launch the project in ...
0
votes
3answers
35 views
Save data from separate columns in a file into a variable in Python 2.7
So I have a sample data in a file, which is of the arrangement:
u v w p
100 200 300 400
101 201 301 401
102 202 302 402
103 203 303 403
104 204 304 404
105 205 305 405
106 206 306 ...
1
vote
4answers
66 views
Why does the parsing of csv file not break things into their 'logical' order?
I'm trying to parse a csv file using the built in python csv reader as follows:
sms_prices_list_url = "http://www.twilio.com/resources/rates/international-sms-rates.csv"
sms_prices_list = ...
1
vote
1answer
24 views
convert all lines in file to lowercase then write to new file
I am trying to read in a file and convert its contents to lowercase then write it back out all lowercase in the same fashion / order ( one word per line and the lines are in alphabetical order ) to a ...
0
votes
1answer
11 views
Use of SET to ignore pre logged users in a looping script
I am trying to use a set in order to stop users being re printed in the following code. I managed to get python to accept he code without producing any bugs, but if I let the code run on a 10 second ...
0
votes
1answer
34 views
replacing text with data from each column in row n in CSV, running script, repeating
I have a CSV file with multiple columns (fixed) and N rows. I need to replace certain text in my script with data/text from every column in n row, run the script, and then repeat with that data from ...