Differences between revisions 108 and 109
Revision 108 as of 2009-02-28 05:12:52
Size: 9639
Editor: 66-192-186-101
Comment: Embedding Python: Distribution Error
Revision 109 as of 2009-04-26 22:08:28
Size: 10027
Editor: 84-75-156-40
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
  *Hi, how can I add or substract two to the last digit of a float? Like 4.9999 should be 5.0001 or 4.9997. The problem is
   >>> 4.9999
  4.9999000000000002
  would yield 4.9999000000000000 or 4.9999000000000004 which is not right.
  I could make a str(4.9999), convert each character to an int and work on each character from right
  to left, but there must be a better way.

See Also: Asking for Help/Why doesn`t this work?

  • Hi, how can I add or substract two to the last digit of a float? Like 4.9999 should be 5.0001 or 4.9997. The problem is
    • >>> 4.9999

    4.9999000000000002 would yield 4.9999000000000000 or 4.9999000000000004 which is not right. I could make a str(4.9999), convert each character to an int and work on each character from right to left, but there must be a better way.
  • Hi, I'm working with embedding Python into my applications. However, the Py_Initialize() is producing an " 'import site' failed " message on non-dev computers. I was wondering if there is a way to fix this or is it just a bug with Python? Thank you.
  • Hi, im trying to run the IDLE but it wont go on. i have an R52 leptop with ibm-tools installed (there is ver 2.2 there but i changed it so it wont ebe the default one). im trying to run ver 2.6. Thank
  • Hi, I'm new to python and I am just working with the idle-shell. How can I write a script without having python executing orders immediately after I type them into the shell? Follow-Up question: Having written the script, how do I run it in the interpreter?
  • How to solve problem when running python from command line?

  • Hi, I just installed MacPython. Unfortunately it doesn't seem to include the CoreGraphics-Python Module. Where ist my old system python? How can I uninstall MacPython?

  • Hi, I am new to Python from Java background, I have following structure
    • /root
              /folder1
                      Class1.py
                      Class2.py
              /folder2
                      Class3.py
      I am in the folder2 and want to run class3.py but it need to import a module from Class1.py Could someone please help me?
  • I believe you just need to add folder1 to your path variable. Should be something along the lines of: import sys; sys.path.append('/root/folder1'); import Class1 (with ; replaced by newlines). If that doesn't work, look through the documentation for info on how the sys.path variable works--I may just have the syntax slightly off
  • Is there any way to get the environment from a subprocess.Popen created by python? In other words, if the new process updates it's environment, is it possible to get access to the modifications. For example In my case I'm executing MS Visual Studio's vsvars32.bat file and would like to access the modified PATH environment variable.

No, it is doing what you told it to do. To realize this you must know that arguments are evaluated before they are passed to the functions. But what is the value of "\g<1>".replace(",", "|")? "\g<1>", of course, as there are no commas to replace in "\g<1>". re.sub therefore receives '"([^"]*)"' and "\g<1>" as arguments, which is the exact equivalent of the first call.

Answered (fully or partially)


CategoryFaq

Asking for Help (last edited 2019-11-04 14:47:35 by ChrisM)

Unable to edit the page? See the FrontPage for instructions.