0
votes
1answer
28 views
Square accumulation don't work
The following script is supposed to compute the sum of integer squares from 0 to 4.
Mathematically, 0²+1²+2²+3²+4²=30, but the script prints 4 when run on Python 3.2! Why?
total = 0
for val in ...
1
vote
1answer
24 views
“argument 1 has unexpected type 'str'”
I'm trying to use PyKDE, PyKDE.kdecore.KStandardDirs to be precise. This method is called with two strings according to the documentation and according to the PyQt4 documentation, I can use standard ...
1
vote
1answer
49 views
How to store user password for third party service in Python?
this doesn't necessarily entail a Python specific answer, but that is what I am using, Python 3.2 to be exact. I am also developing under Linux.
I have a script that is connecting to a website, ...
1
vote
2answers
62 views
Python 3 syntax error with def function((x,y))
So I'm analyzing this code and I have reason to believe this was coded with python 2.X but I'm using 3.2 and would like to convert it so that it would work.
The first error I encountered was with a ...
0
votes
2answers
49 views
spaced output beautifulsoup
Im trying to scrap the contents of a website. However in the output im getting unwanted spaces and hence im not able to interpret this output. Im using a simple code :
import urllib2
from bs4 ...
0
votes
0answers
16 views
Python telnet connection not able to moniter the Shell which is Invoked from telnet
[python]
I telnet to a windows machine through python Telnetlib and
i have an interactive tool in my windows machine. In order to access that
tool, I have to type this command "nxshell" in command ...
0
votes
1answer
25 views
How to use __len__ method rapper, Python 3.x
I'm parsing an XML file, in which i use elements,currently my element name is __word__
In the elements I have an attribute called __attrs__,
When I debug I can see this __attrs__ has a method wrapper ...
0
votes
2answers
27 views
How to use threads to get input from keyboard in python 3?
I am making a snake game which requires the player to press the WASD keys without stopping the game process to to get input from player. So I can't use input() for this situation because then the game ...
0
votes
1answer
28 views
What WSGI version should i use to build a python framework from scratch?
I'm about to build a python framework from scratch...
so, im confused about the WSGI/Python version, (WSGI 1.0 used for python 2.x, WSGI 1.0.1 for python 3.x).
what is the best version should i start ...
-1
votes
0answers
36 views
Python 3 Cookie Example [closed]
I'm looking for a Python 3 cookie example. I'm looking at
http://docs.python.org/3.2/library/http.cookies
and
http://docs.python.org/3.2/library/http.cookiejar.html
but I'm not quite sure of ...
2
votes
3answers
72 views
split the file in many other files using python
I have a file which I want to split it into many other parts. i want to use python code...
Eg: the data in my file is like this
>2165320 21411 200802 8894-,...,765644-
...
1
vote
1answer
49 views
Python - Different ways of printing?
I've installed PyDev into Eclipse, and when I do the print method in a .py file as print "Hello World" it didn't work. But then I did print ("Hello World") and it worked. I looked on the internet and ...
1
vote
2answers
51 views
Faster way of getting files with certain text in them in Python?
I have lots and lots of files in a list called files, which I am looping through and saving all the files which have //StackOverflow on the very first line. It might have some additional text after ...
-4
votes
1answer
36 views
How to deal with default argument values as accumulators? [closed]
In python, we could set default argument values while define a function. But the default argument values are evaluated on once. So if we change the values of such arguments in the function, the change ...
0
votes
1answer
29 views
StringTemplate 4 and Python
I've just found out StringTemplate and wanted to test it in python. Does v4 work in Python (2.7/3)? Wiki is empty and I can't find any info about python port for v4 version. v3 is the only working ...