473,545 Members | 2,057 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.
5
29,145
thread by: bkunjitam | last post Dec 1 '06 by: bartonc
Hi, My programme has a text box where in user enters the ip address. I need to validate the IP (like no space allowed in the entry, the numerals should not exceed 255, not more than 3 dots allowed overall, no consecutive dots allowed etc.,.). How do i go about the same? Is there any built in function for the same? thanks, Badri
3
29,147
thread by: Bouzy | last post Nov 5 '08 by: markus314
I have a list of words and am trying to replace all the numbers in my list with whitespace. for word in words: numbers = re.search('+', word) word = clearup(word) if word in dictionary: pass else: print word
35
29,190
thread by: erikwickstrom | last post Oct 11 '06 by: MonkeeSage
Hi all, I'm sorry about the newbie question, but I've been searching all afternoon and can't find the answer! I'm trying to get this bit of code to work without triggering the IndexError. import shutil, os, sys
5
29,201
thread by: Peter Watkins | last post May 26 '07 by: bartonc
I'd like to convert a little endian hex string: '00020000020000FC' to a number. I was going to use struct.unpack('>q', theString) but this is meant for a string where the bytes in the string correspond to bytes in the number. I think that something like the opposite of the hex() function would work perfect as long as it supported...
9
29,210
thread by: wordsender | last post Jul 18 '05 by: Abhijit Soman
Hey guys, I can't figure this one out, why is this simple script giving me problems? logfile=file(r'test.txt','w') logfile.write('datetime') test=logfile.readlines() When I run it I get the error message:
3
29,280
thread by: william hoskins | last post Feb 7 '11 by: william hoskins
Hey everyone, I am fairly new to python, and I was working on a google app engine project for a class, and this error came up. I wasn't sure why, because right above it I have the same object type right above it, and when I take the filter off the other, it works fine, I just can't do that or it screws everything up def LoginBar(): user =...
12
29,328
thread by: NareshKonda | last post Feb 17 '23 by: Vanisha
Right from data development to web development, Python has become the most famous and an important open source programming language used in today’s scenarios. In many IT forums, it is discussed that if you want to find the most used colors in a picture, you use Python, if you want to develop a web app then you use Python if you want to automate...
4
29,408
thread by: sophie_newbie | last post Oct 18 '07 by: Paul Hankin
Hi, in my program i need to call a couple of functions that do some stuff but they always print their output on screen. But I don't want them to print anything on the screen. Is there any way I can disable it from doing this, like redirect the output to somewhere else? But later on in the program i then need to print other stuff so i'd need...
3
29,423
thread by: Peter Moscatt | last post Jul 19 '05 by: Brian Beck
I am wanting to return the system date using the following: date.today() How would I then convert this to a string ? Pete
30
29,480
thread by: bdsatish | last post Jun 27 '08 by: Lie
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2 # As expected my_round(2.5) = 2 # Not 3, which is an odd num I'm interested in rounding numbers of the form "x.5" depending upon whether x is odd...
2
29,494
thread by: Liu Kun, SLC ICM (BJ) | last post Jul 18 '05 by: Daniel Dittmar
Hello, I want to use a method from _xxx_yyy.pyd, but I can not use import to load this file, how to use .pyd in python interpreter? Best Regards Liu Kun
4
29,550
thread by: yinglcs | last post Mar 19 '06 by: Steve Holden
I check the documentation here, but it does not say how to check if a directory is exist in python? http://docs.python.org/lib/os-file-dir.html And why mkdir fails if the directory already exists? Thank you.
2
29,731
thread by: learnerofpython | last post Nov 15 '10 by: David Hall
hi! What wud be the python equivalent of the C statement while(some condition); (i.e no statement gets executed) any ideas.please let me know
7
29,769
thread by: 23rnj3mn32sdjqw | last post May 6 '09 by: IceMan85
Hi, It should be simple - but I am trying to find the difference between two datetimes as an integer in seconds. Using pywin32 build 212, python 2.5, Windows XP Pro, MySQL 5.0. import time import datetime def date4string(string): return datetime.date(*time.strptime(string, "%Y-%m-%d %H:%M:%S"))
5
29,775
thread by: runsun | last post May 19 '07 by: bartonc
Read from an existing file, then output a file with the same name but an extension: file = raw_input ('Enter the filename:\n') fileout = open ('file.out', 'w') However, when I enter a filename like "test", it gives the output file as "file.out" instead of "test.out".
12
29,949
thread by: wocosc | last post Mar 6 '07 by: bartonc
Hey, I have a problem. I was presented a problem where I need to open a file and then copy and rename it. We are still using really basic commands, but I am pretty lost with this. I know how to open a file and get python to read it. Any help would be great.
1
29,995
thread by: tshravan | last post Mar 24 '08 by: jlm699
Hello All, I am newbie to python. I was trying to use a=zeros(5) in python shell, but it is throwing the following exception in the shell Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'zeros' is not defined
6
30,011
thread by: silverburgh.meryl | last post Feb 19 '07 by: Martin Blume
Hi, I have a function called 'test' defined in A.py. How can I call that function test in my another file B.py? Thank you.
3
30,060
thread by: Vishy147 | last post Aug 24 '10 by: jarfoss
Hi, I am new to python. I have to devlope a small for code for getting the path of a particular folder, that is given as input to the code, in the other folder. Basically i have to search a folder, not file, inside another folder. I work on windows platform. Can anybody help me.
9
30,099
thread by: manuel | last post Jul 18 '05 by: Manish Jethani
How to convert a decimal to binary ? thx, Manuel
7
30,121
thread by: Fernando Rodriguez | last post Jul 18 '05 by: Jeremy Fincher
Hi, How can I check for the xistence of any file that matches a wildcard? For example: ppis-*.iss os.path.exists() doesn't expand the wildcard...
3
30,193
thread by: ElBeardo | last post Oct 31 '16 by: Mandy786
Hello, I´m new to Python.. so this is a newbee question. I´d like to put the value enterd in the entryfield in a variable. I´m trying to build a calculator with python and TKinter, coding it in just python works good. But making it with TK is a bit hard. This is my unfinished code, i have tryed get() in many ways,.but I cant make it work....
1
30,275
thread by: fareedcanada | last post Mar 28 '24 by: dev7060
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like 1,13,1,15,16,17 I am trying to code like if linecnt == 12 : numList = ...
8
30,469
thread by: Derek Basch | last post Mar 1 '06 by: Derek Basch
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. Thanks, Derek Basch P.S. I suck at math so feel free to make me feel stupid if it is really easy to do :).
4
30,473
thread by: Tor Erik Sønvisen | last post Jul 18 '05 by: Jeff Sandys
Hi How can I read the first line of a file and then delete this line, so that line 2 is line 1 on next read? regards

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.