Tagged Questions
0
votes
1answer
18 views
Why this sqlite python 3x code is not compatible with python 27
I´m new on python and am developing an app with python 2.7, and got this nice code for python 3.x that doesn´t work in my version. I´ve been trying to adapt it for it´s beauty but couldn´t see the ...
0
votes
1answer
18 views
Python datetime weird behavior
I trying this in Python. What is the difference of those:
>>> a = datetime.fromtimestamp(1373576406)
>>> a.replace(tzinfo=tzutc())
datetime.datetime(2013, 7, 12, 0, 0, 6, ...
2
votes
1answer
52 views
How can I use Python strings so that the same code works in 2.6, 2.7, 3.x
I want to write some simple Python scripts that can be used unmodified on different Python versions, but I'm having trouble with strings...
text = get_data()
phrases = [ "Soggarth Eogham O'Growney ...
-5
votes
2answers
44 views
Python: Useful Rational Class with operator overloading [on hold]
So I'm trying to create the following class in python:
The class should use integer instance variables to store the numerator and denominator of the rational number.
The rational number must be ...
0
votes
2answers
22 views
Embedding Python in a Visual Studio 2012 C++ Project
I included the usage of python scripts for my c++ project in Visual Studio 2010 like described in the CodeProject article: http://www.codeproject.com/Articles/11805/Embedding-Python-in-C-C-Part-I
...
0
votes
0answers
38 views
Pygame with python 3.3 pros and cons? [on hold]
I started a project on my own and someone wants to collaborate with me. He wants to code with python 3.3 and I know that pygame has been ported to 3.3. I currently developped my whole game with 2.7.
...
0
votes
0answers
5 views
Twython gives me an error in python2.x but works fine in 3.x
Twython gives me an error in python2.x but works fine in 3.x for a basic search query as given in the documenation. I would like to use this in a Flask app and Flask only supports Python 2.x as of ...
0
votes
1answer
19 views
How to send a broadcast packet with specific format using Python
I need to send a request broadcast packet to 255.255.255.255 port 1000
I don't know how to send 0x01 as first byte and the following 4 bytes is a random number.
Thanks you all, in advance
import ...
0
votes
0answers
5 views
Installing packages with pip when two versions of python exist in the same system
I have a big problem with the package installation in python.
python 2.7 and python 3.3 are already installed on my system, i also installed the latest version of pip but when I manage to install a ...
1
vote
2answers
60 views
How to check immutability [duplicate]
In python, is there any way to check if an object is immutable or mutable?
like isimmutable(a) would return True, if a is immutable, else returns False.
0
votes
1answer
40 views
vim regex for python2 print to python3
So say I have a python v2.7 file with some code like this:
print 'asdf'
print 'hi mom!'
But I want to run it in python3, I'll need to add those parenthesis to them like so:
print('asdf')
print('hi ...
0
votes
2answers
42 views
create a list of files from a directory with various parameters
My folder has .jpg files as follows:
D:\\myfolder\\a.b2001001.c05.jpg
D:\\myfolder\\a.b2001002.c08.jpg
D:\\myfolder\\a.b2001003.c07.jpg
D:\\myfolder\\a.b2001004.c09.jpg
...
...
...
-2
votes
1answer
30 views
text file manipulation in python for extracting specific characters
How to extract the desired text from the following text file?
<SimpleData name="h">0</SimpleData>
<SimpleData name="v">10</SimpleData>
<SimpleData ...
0
votes
2answers
35 views
How to create the PYTHON version of this PHP script. ( reads from php://stdin )
I have a working php script that actually intercepts the incoming e-mail from sendmail and saves it to a file.
here it is:
<?php
$fd = fopen("php://stdin", "r");
while (!feof($fd)) {
$email ...
0
votes
1answer
44 views
how to define same variable for two values using python
This question is how to define same variable for two values using python.
min_lat = 10
min_lat = lower_right_lat = lower_left_lat
I should get the result for both the lower_right_lat and ...
0
votes
1answer
17 views
'Check all boxes' Check box in Python
Using python and tkinter I have an app that dynamically creates lots of check boxes (around 40) and i would like to add another one that preceeds them that can check all of the checkboxes
An example ...
0
votes
3answers
62 views
Understanding lambda functions
Well I did try to read about Lambda functions but did not get across any link which explains few questions about its flow and the way it is handled by python interpretor or may be I could not ...
1
vote
2answers
34 views
how to get list of files from a directory into text file using python
This question is how to get list of files from a directory into text file using python.
Result in the text file should exactly be like this:
E:\AA\a.jpg
E:\AA\b.jpg
...
How to correct the code ...
0
votes
1answer
22 views
Tkinter text highlight specific lines using keyword
I looking for a simple way to search through a line of text and highlight the line if it contains a specific word. I have a tkinter text box that has lots of lines like:
"blah blah blah Failed blah ...
1
vote
2answers
33 views
Writing a text file using python
How can I write exactly the test below using python into a text file? This is required when I have to write several text files with different parameters.
MY_FILE = E:\test.jpg
BAND_SUBSET = ( 1 0 0 ...
-1
votes
2answers
20 views
I have installed with yum install python-devel ,but still can not find the Python.h file [closed]
I have run the command yum install python-devel,and the output is :
yum install python-devel
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> ...
2
votes
1answer
33 views
Python 2.7 vs Python 3.3 for Django development
We are just starting some cloud-based apps based on Python + Django and we have a small dilemma. At first we decided to go with Python 3.3, but than we saw that a lot of libraries/modules have not ...
0
votes
1answer
47 views
For each and every ssh command asks for password, Python
I am trying to execute the following code, which asks me password for each and every ssh command though I provide my password in the code. Can any one please tell me where I am doing mistake. Thanks ...
0
votes
1answer
30 views
Python key binding
I'd like to know the simplest way to bind keys in python
for example, the default python console window apears and waits, then in psuedo ->
if key "Y" is pressed:
print ("Yes")
if key "N" is ...
0
votes
3answers
39 views
Extracting some data from an HTML file and writing it to another file
Given that we have an HTML file as shown below:
</pre>
<pre><img src="/icons/blank.gif" alt="Icon "> <a href="?C=N;O=D">Name</a>
<img ...
0
votes
1answer
18 views
Python handle custom exception from java web service
I have a java web service and python client using suds. My server raises custom exceptions which I would like to handle in the python script. Is it possible to catch them or it always will be caught ...
0
votes
1answer
31 views
Image does not open with python imaging library
I have just installed the Python imaging library and started to learn it but I cannot sem to open the image file.
import Image
im = Image.open("Desert.jpg")
print im.format, im.size, ...
-1
votes
1answer
29 views
How to link or embed a Python code into Facebook. I made a cool math game and want to share it [closed]
I am in my early stages of writing Python Code and recently wrote a cool, entertaining math trick. Everybody loves it. How would I go about creating an interface that enables people of Facebook to ...
2
votes
5answers
78 views
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:
[7, 7, 7, 7]
I want them to simply print like this:
7777
I don't want brackets, commas or quotes. What to do?
-1
votes
4answers
63 views
Count number of lines of a text file in python [closed]
How can i count number of lines of a text file in python?
for example, the text file (f.txt) looks like
qwer
asdf
zxcv
tyui
ghjk
bnm,
possible code can be:
with open ('f.txt', 'r') as text:
...