I'm testing a Python parser. I have Python 2.6/2.7 firmly under control,
and some good (large) code samples on which I've tested it.
I'm interested in testing my Python3 variant. I've been to various
Python open source web sites (e.g., http://pythonsource.com/), which
list lots of packages, but they are pretty unclear as whether the...
Found some info on porting packages from python 2 to 3 using distribute setuptools in below link.
http://packages.python.org/distribute/python3.html
I have a C api which could be build using python 2.x, but i need to build it in python 3.x.
Can it be done using distribute.
Do anyone have idea on this?
...
As per the below link porting python packages from 2 to 3 would be easy when distribute is used.
Is tat true?
anyone tried before?
karnol
...
Here's my code:
#This is a game to guess a random number.
import random
guessTaken = 0
print("Hello! What's your name kid")
myName = input()
number = random.randint(1,20)
print("Well, " + myName + ", I'm thinking of a number between 1 and 20.")
while guessTaken < 6:
print("Take a guess.")
guess = input()
guess = int(guess)...
Here's my code:
from urllib.request import urlopen
response = urllib.urlopen("http://www.google.com")
html = response.read()
print(html)
Any help?
...
I have this code (Reset.py) that works how I want it to unless I import it.
class Res(object):
defaults={}
class NoKey: pass
def __init__(self):
for key, values in defaults.items():
globals()[key]=values
def add_defaults(key, values):
Res.defaults[key]=value
def remove_defaults(key=NoKey, ...
I'm new to Python 3 and so far it seems like a decent language. I really like the string manipulation methods you can use and they are pretty radical. :)
I'm stuck however in thinking of a project to do with Python. Is there a site similar to Coding4Fun but for Python?
Community Wiki because I think this question is really interesting....
I'm trying to construct a dictionary that contains a series of sets:
{Field1:{Value1, Value2, Value3}, Field2{Value4}}
The trouble is, I then wish to delete any fields from the dictionary that only have one value in the set. I have been writing code like this:
for field in FieldSet:
if len(FieldSet[field]) == 1:
del(FieldSet[fie...
I'm still a beginner to Python, so I thought I could as well learn the newest iteration of Python. Especially since it is now 3.1 or 3.2 something.
But it seems like many mayor modules are still only supported by 2.6. Like the python-mysql module; from what I read on http://mysql-python.blogspot.com/ it seems like 3.x support won't be s...
Our C++ lib works fine with Python2.4 using Swig, returning a C++ char* back to a python str. But this solution hit problem in Python3.0, error is:
Exception=(, UnicodeDecodeError('utf8', b"\xb6\x9d\xa.....",0, 1, 'unexpected code byte')
Our definition is like(working fine in Python 2.4):
void cGetPubModulus(
void* pSslRsa,
ch...
I'd like to be able to post twitter messages from python 3.0. None of the twitter API I have looked at support python 3.1. Since the post proceedure only requires this :
JSON: curl -u username:password -d status="your message here" http://api.twitter.com/1/statuses/update.json
I was wondering if it is possible with the standard libra...
When I run, for example:
print("[",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ")
time.sleep(1)
print("=",end=" ...
I get this error when trying to take an integer and prepend "b" to it, converting it into a string:
File "program.py", line 19, in getname
name = "b" + num
TypeError: Can't convert 'int' object to str implicitly
That's related to this function:
num = random.randint(1,25)
name = "b" + num
...
Is there a way to generate random letters in Python (like random.randint but for letters)? The range functionality of random.randint would be nice but having a generator that just outputs a random letter would be better than nothing.
...
I have a script which contains two classes. (I'm obviously deleting a lot of stuff that I don't believe is relevant to the error I'm dealing with.) The eventual task is to create a decision tree, as I mentioned in this question.
Unfortunately, I'm getting an infinite loop, and I'm having difficulty identifying why. I've identified ...
I am trying to install distribute using ActivePython 3.1.2 on Windows.
Running python distribute_setup.py as described on the cheese shop give me:
No setuptools distribution found
running install
Traceback (most recent call last):
File "setup.py", line 177, in
scripts = scripts,
File "C:\Dev\Python_x86\3.1\lib\distutils\c...
My project uses buildout to do primarily two things: automatically fetch dependencies and create scripts; and setup cron jobs (on deployment machines) using the usercrontab buildout recipe.
But buildout is not yet available for Python 3.
So I would like to consider alternatives for buildout. I know that both virtualenv and pip work on ...
A value which is a PyUnicodeObject need to be passed to PyObject variable.
Is there any conversion method for that?
thanks
karnol
...
How to convert pyunicodeobject type to pybytesobject type?
Example:
function(PyBytesObject* byteobj){
....operation..
}
PyUnicodeObject* Uniobj;
function((PyBytesObject*) Uniobj);
got a bus error as a result.
...
Am surprised there's 3 different forms: RawConfigParser, SafeConfigParser and ConfigParser. I read the differences but why isn't everyone using SafeConfigParser, since it seems, well, safe? I can understand that in the case for Python 2 that the other two were kept for backward compatibility.
...