0

Can anyone give this a try?

'''print_error_python33.py
there are times when a print() trailing newline disappears with Python 3.3.0
this does not happen with Python 3.2.3 or Python 2.7.3
'''

size = 180000
print("creating long string of %d sevens" % size)

# create a long string of digits
s2 = '7' * size

# looks like this print() loses its trailing newline at times 
print("start converting ...")

n = int(s2)

print("converted string to integer")

#print("Int converted            : {}".format(timenow()))

'''my result (Windows7 OS, Python 3.3.0)
print() newline is swallowed with 180000 or more digits >>>

creating a long string of 180000 sevens
start converting ...converted string to integer


print() behaves normal with 170000 or less digits>>>

creating a long string of 170000 sevens
start converting ...
converted string to integer
'''
4
Contributors
3
Replies
21
Views
4 Years
Discussion Span
Last Post by vegaseat
Featured Replies
  • In my experience this error is not the fault of Python 3.3.0 but the fault of your IDE. I have run into a similar problem (prime number function) with the EDITRA IDE, any other IDE like IDLE, PyScripter or ConTEXT does not have a problem. Read More

0

Print sys.maxint to see what it says. You are probably going beyond the computer's limit. It depends on your OS: 32 bit or 64 bit. For more precision take a look at the decimal module. If you want to actually do anything with a number than contains 180,000 digits, decimal is the only way to go.

Edited by woooee

1

In my experience this error is not the fault of Python 3.3.0 but the fault of your IDE.
I have run into a similar problem (prime number function) with the EDITRA IDE, any other IDE like IDLE, PyScripter or ConTEXT does not have a problem.

Edited by Lardmeister

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.