python-3.x
Python 3 gives wrong output when dividing two large numbers?
a = 15511210043330985984000000# (25!) b = 479001600# (12!)开发者_运维百科 c = 6227020800# (13!) On dividing ans = int(a/(b*c)) or ans = int((a/b)/c) we get ans equal to 5200299 instead of 5200300In[详细]
2023-04-08 19:23 分类:问答Decimals to 2 places for money in Python 3
How do I get my decimals to stay at 2 places for representing money using the decimal开发者_Go百科 module?[详细]
2023-04-08 18:54 分类:问答Converting dynamic, nicely formatted tabular data in Python to str.format()
I have the following Python 2.x code, which generates a header row for tabular data: headers = [\'Name\', \'Date\', \'Age\'][详细]
2023-04-08 14:35 分类:问答Unicode literals causing invalid syntax
The following code: s = s.replace(u\"&开发者_StackOverflow中文版\", u\"&\") is causing an error in python:[详细]
2023-04-08 13:00 分类:问答Unknown syntax error on creating a simple widget in Tkinter
I was following this tutorial (http://sebsauvage.net/python/gui/#add_button) on making widgets with Tkinter. I have been making sure to follow it very carefully but, when I run it now in step 10, I ge[详细]
2023-04-08 12:01 分类:问答Python 3 Building an array of bytes
I need to build a tcp frame with raw binary data, but all ex开发者_运维知识库amples and tutorials I\'ve found talking about bytes always involve conversion from a string, and that\'s not what I need.[详细]
2023-04-08 08:36 分类:问答How to correct TypeError: Unicode-objects must be encoded before hashing?
I have this error: Traceback (most recent call last): File \"python_md5_cracker.py\", line 27, in <module>[详细]
2023-04-08 03:23 分类:问答Switch between two frames in tkinter?
I have built my first few scripts with a nice little GUI on them, as the tutorials have shown me, but none of them address what to do for a more complex program.[详细]
2023-04-08 01:40 分类:问答python precautions to economize on size of text file of purely numerical characters
I am tabulating a lot of output from some network an开发者_Go百科alysis, listing an edge per line, which results in dozens of gigabytes, stretching the limits of my resources (understatement). As I on[详细]
2023-04-07 21:12 分类:问答Python 3 concurrent.futures socket server works with ThreadPoolExecutor but not ProcessPoolExecutor
I am trying to create a simple socket server using the new concurrent.futures classes. I can get it to work fine with ThreadPoolExecutor but it just hangs when I use ProcessPoolExecutor and I can\'t u[详细]
2023-04-07 17:51 分类:问答