473,543 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Forum

Python programming language - Ask questions about python interpreter, control flow, data structures, modules errors, classes, standard library, gui, databases, unit testing, object oriented, structured programming and more.
4
22,038
thread by: pdlemper | last post Nov 19 '07 by: Terry Reedy
Have carefully installed Python 2.5.1 under XP in dir E:\python25 . ran set path = %path% ; E:\python25 Python interactive mode works fine for simple arithmetic . Then tried >> import math Get error Name error : name 'sqrt' is not defined Same thing with sin(x) . I'm unable to find "math" , "sqrt" , or "sin" anywhere in lib , Libs or...
7
22,052
thread by: none | last post Jul 18 '05 by: Jorge Luiz Godoy Filho
I want to determine the outside (non local, a.k.a. 127.0.0.x) ip addresses of my host. It seems that the socket module provides me with some nifty tools for that but I cannot get it to work correctly it seems. Can someone enlightened show a light on this: import socket def getipaddr(hostname='default'): """Given a hostname, perform a...
13
22,074
thread by: HNT20 | last post Apr 16 '06 by: Grant Edwards
Hello All i am new to python language. i am working on a gnuradio project where it uses python as the primary programming language. i am trying to convert a message, text, or numbers into binary code so that i can process it. i googled many times and tried many of the answers out there, no luck so far. is there a way to convert a...
5
22,094
thread by: lepetal | last post Jan 10 '13 by: AndrewM
I need to calculate delta between SYN and SYN-ACK or ACK packet for each http.uri request. Why is my code not working for it? #!/usr/bin/env python import dpkt def ip_decode(p):
4
22,113
thread by: Mason | last post Jun 1 '08 by: Mason
I have tried and tried... I'd like to read in a binary file, convert it's 4 byte values into floats, and then save as a .txt file. This works from the command line (import struct); In : f = open("test2.pc0", "rb") In : tagData = f.read(4) In : tagData
7
22,120
thread by: elnoire | last post Jun 27 '08 by: Andrew Lee
Greetings! I've just started learning python, so this is probably one of those obvious questions newbies ask. Is there any way in python to check if a text file is blank? What I've tried to do so far is: f = file("friends.txt", "w")
29
22,127
thread by: Mark Hahn | last post Jul 18 '05 by: Fredrik Lundh
We are considering switching to the dollar sign ($) for self, instead of the period ( . ) we are using now in Prothon. Ruby uses the at-sign (@) for self, but our new usage of self also includes replacing the period for some attribute references, as in obj$func() versus obj.func(), and too many programs treat that as an email address and...
5
22,128
thread by: Patrick David | last post Jun 27 '08 by: Larry Bates
Hello NG, I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? Hope for help Patrick
9
22,152
thread by: Paul Watson | last post Jul 18 '05 by: Bengt Richter
I thought that using a comma at the end of a print statement would suppress printing of a newline. Am I misunderstanding this feature? How can I use print and not have a newline appended at the end? C:\src\projects\test1>python -c "import sys;print sys.version, 'running on', sys.platform" 2.3.4 (#53, May 25 2004, 21:17:02) running on...
6
22,164
thread by: ramon aragues | last post Jul 18 '05 by: Phil Frost
Hi, I´ve got a list with more than 500,000 ints. Before inserting new ints, I have to check that it doesn´t exist already in the list. Currently, I am doing the standard: if new_int not in long_list: long_list.append(new_int)
6
22,192
thread by: Tuang | last post Jul 18 '05 by: Tuang
I've been looking all over in the docs, but I can't figure out how you're *supposed* to parse formatted strings into numbers (and other data types, for that matter) in Python. In C#, you can say int.Parse(myString) and it will turn a string like "-12,345" into a proper int. It works for all sorts of data types with all sorts of...
7
22,215
thread by: Marco | last post Feb 17 '07 by: Gabriel Genellina
Hello,every one, I meet a question: in my old script, I usually use os.popen2() to get info from standard unix(LinuX) program like ps,ifconfig... Now, I write a OO-based programme, I still use os.popen2( check whether mplayer still working via ps command ), but some things I got the following message: Traceback (most recent call last):
6
22,241
thread by: jcollins | last post Jul 18 '05 by: Andrew Robert
Is there a command in Python to clear the screen? That is without writing multiple blank lines. Thanks. Jim C
11
22,316
thread by: fdu.xiaojf | last post Oct 16 '06 by: Grant Edwards
Hi, I just want to send a very simple email from within python. I think the standard module of smtpd in python can do this, but I haven't found documents about how to use it after googleing. Are there any examples of using smtpd ? I'm not an expert,so I need some examples to learn how to use it. Or maybe there is a better way to to...
6
22,322
thread by: Dave Kuhlman | last post Jul 18 '05 by: Dave Kuhlman
Is JPE (the Python Java Extension) being used widely/actively? I tried to build it (with Python 2.3.4, j2se 1.4 on Debian GNU/Linux) and had quite a bit of trouble. And, then, the samples did not run. Is there another way to call Java code from Python? The JPE project does not seem too active lately, or is it?
2
22,353
thread by: mcdurr | last post Nov 2 '06 by: Robert Kern
I recently installed Python 2.5 on Windows and also installed numpy 1.0. I'd like to compute an FFT on an array of numbers but I can't seem to access the FFT function. I'm fairly new to Python (obviously) and I can't seem to find documentation to match my distribution of numpy and I can't figure out how to access the FFT function. Python...
18
22,373
thread by: robert | last post Nov 16 '06 by: robert
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? -robert PS: numpy.corrcoef computes only the bare coeff:
1
22,413
thread by: randomtalk | last post Apr 29 '06 by: randomtalk
hello everyone! I can't seem to find a function that combines a list of items into a string with a seperator between the individual elements.. Is there such a method that does the opposite of sting.split? thanks alot!
6
22,462
thread by: samn | last post Oct 23 '06 by: samn
i compiled and installed the release version of python 2.5 for linux to a directory accessible to 2 computers, configured with --prefix=/usr/arch (which is accessible to both machines). the installation went fine and when i run python on one machine i can do from hashlib import * without a problem. on the other machine i get the following...
20
22,473
thread by: Jack | last post Jul 17 '06 by: Petr Jakeš
Is there a Python packaging that is specifically for embedded systems? ie, very small and configurable so the user gets to select what modules to install? For Linux-based embedded systems in particular? I'm thinking of running it on the Linksys's Linux-based open source router WRT54G. It has 4MB flash and 16MB RAM. I think another model...
12
22,497
thread by: Byte | last post Feb 14 '06 by: Fredrik Lundh
Pretty much self explanatry, where are Python modules stored in Linux? (i.e. in /usr/bin/local, or where?)
10
22,512
thread by: Stephen M. Gava | last post Apr 22 '07 by: Stephen M. Gava
Hi all, I prefer using tkinter to wxpython (so sue me :) and i need to display a lot of html in a particular app. does anyone know if one of the existing add on tk html widgets have been wrapped for tkinter already? TIA for any reply, Stephen
9
22,513
thread by: Krisztian Kepes | last post Jul 18 '05 by: Christoph Becker-Freyseng
Hi ! I want to create an module and I want to use some Global Constant in it. How to I create an global constant in module what is accessable in from other modules ? like this example: *** module dirs *** const Const_Up=1 const Const_Down=1
14
22,530
thread by: micklee74 | last post May 12 '06 by: John Machin
hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the first occurence. I want to know the positions of both "1234" thanks
10
22,595
thread by: kevinliu23 | last post Mar 1 '07 by: kevinliu23
HI, I am new to Python and wanted to know how to check for the remaining disk space on my Windows machine using Python? I was thinking of using the command line "dir" and trying to extract the output from there. But I'm not sure how to extract command line strings using Python either. Anyway help would be appreciated. :)

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.