| |
thread by: Ros |
last post Mar 9 '07 by: Gabriel Genellina
There are 10 files in the folder. I wish to process all the files one
by one. But if the files are open or some processing is going on them
then I do not want to disturb that process. In that case I would
ignore processing that particular file and move to next file.
How can I check whether the file is open or not?
I tried os.stat and...
|
thread by: John Salerno |
last post Jun 27 '08 by: John Salerno
I wrote some pretty basic socket programming again, but I'm still confused about what's happening with the buffer_size variable. Here are the server and client programs:
--------------
from socket import *
host = ''
port = 51567
address = (host, port)
buffer_size = 1024
|
thread by: karthikr_04 |
last post Sep 12 '06 by: bartonc
Hello ,
I am new and I was stuck with the ord function.
When i passed the value like this it gave me proper o/p:
>>ord('\x16')
22
but when i concatenate '\x' and 16 the length of the string becomes 4 and it gives error.What's the method to convert it into ASCII like the one above for a string.
|
thread by: py |
last post Nov 22 '05 by: py
I have a python script that I want to test/debug. It contains a class
which extends from some other class which is located in some other
python file in a different directory.
For example:
c:\python_code\foo.py
|
thread by: desktop |
last post Jun 17 '07 by: Dave Borne
I have this class:
class case(blop.case):
def __init__(self, n, a, b):
blop.case.__init__(self)
print 'Monty Python's Flying Circus has a ' within it...'
...
...
But I get an error when I run the .py script from shell saying:
|
thread by: devi thapa |
last post Nov 12 '08 by: Grant Edwards
Hi,
I am executing a python script in a shell script. The python script
actually returns a value.
So, can I get the return value in a shell script? If yes, then help me out.
Regards,
Devi
|
thread by: vince1266 |
last post Feb 26 '10 by: bferguson94
I have a little bit of trouble finding the median in a list. I am trying to ask the user what his/her marks are and i am trying to find the median. I have a little bit of trouble because the user could be inputting either an odd or an even number of marks but i don't know how to ask him/her. it would be great if someone could help me. This is what...
|
| |
thread by: Gian Mario Tagliaretti |
last post Jul 18 '05 by: Peter Hansen
Hi all,
It is (I hope) a simple question,
I cannot figure out why sys.stdout.write() doesn't print immediatly the first
text in the small example below, but before it process the code in between
and then print both lines in one time.
#!/usr/bin/env python
import sys, time
sys.stdout.write('write ')
|
thread by: newbie1 |
last post Nov 23 '07 by: crampio
Dear All,
I am new to python. I need to write ctrl-z to a serial port to signal the end of input. This is required by the message format. I use:
ser = serial.Serial(port=COMPORT,baudrate=BAUDRATE,bytesize=8,parity='N',stopbits=1,timeout=3,xonxoff=0,rtscts=0,)
ser.open()
ser.write("testing\x1A")
But the ctrl-z (ascii 26) doesn't seem to...
|
thread by: hokiegal99 |
last post Jul 18 '05 by: François Pinard
How do I say:
x = string.find(files, 'this', 'that', 'the-other')
currently I have to write it like this to make it work:
x = string.find(files, 'this')
y = string.find(files, 'that')
z = string.find(files, 'the-other')
|
thread by: Steven W. Orr |
last post Feb 19 '07 by: Steven D'Aprano
I have a table of integers and each time I look up a value from the table
I want to call a function using the table entry as an index into an array
whose values are the different functions. I haven't seen anything on how
to do this in python.
TIA
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened...
|
thread by: hokieghal99 |
last post Jul 18 '05 by: hokiegal99
import os, string
print " "
setpath = raw_input("Enter the path: ")
def find_replace(setpath):
for root, dirs, files in os.walk(setpath):
fname = files
for fname in files:
find = string.find(file(os.path.join(root,fname),
'rb').read(), 'THIS')
print find
|
thread by: could ildg |
last post Aug 9 '05 by: Scott David Daniels
I want to check if a folder named "foldername" is empty.
I use os.listdir(foldername)== to do this,
but it will be very slow if the folder has a lot of sub-files.
Is there any efficient ways to do this?
Thanks~
|
thread by: foker500 |
last post Apr 13 '15 by: dwblas
I'm a newbie so please excuse my ingnorance. I have serveral hunderd files in a folder and need to change the file extension from '.pnt' to '.txt'. Any suggestions?
Thanks
|
thread by: mike420 |
last post Jul 18 '05 by: Raffael Cavallaro
I think everyone who used Python will agree that its syntax is
the best thing going for it. It is very readable and easy
for everyone to learn. But, Python does not a have very good
macro capabilities, unfortunately. I'd like to know if it may
be possible to add a powerful macro system to Python, while
keeping its amazing syntax, and if it...
|
| |
thread by: Alex1980 |
last post Aug 19 '10 by: Alex1980
hi,
here's the situation: I'm trying to build a GUI for a Genetic Algorithm that has a number of elements (labels) updated every iteration of the run.
I've tried doing it in the widget (Label) (1) and in the mainframe (2), but neither worked.
...
|
thread by: sangeeth |
last post Apr 30 '07 by: bartonc
I have a very big python file which uses lists,tuples and dictionary.
The problem is that the program always crashes with Memory error.
Can anyone suggest how to solve this problem??
|
thread by: Tor Erik Sønvisen |
last post Sep 22 '05 by: Max M
Hi
Is there any simpler way to convert a unicode numeric to an int than:
int(u'1024'.encode('ascii'))
??
regards tores
|
thread by: many_years_after |
last post Aug 20 '06 by: Gerhard Fiedler
Hi,everyone:
Have you any ideas?
Say whatever you know about this.
thanks.
|
thread by: Rune Strand |
last post Jul 18 '05 by: Bengt Richter
Hi,
If I have a lot of integers and want do something with each digit as
integer, what is the fastest way to get there?
Eg. Make 12345 into an iterable object, like or "12345"
(Btw: What is the English term for this process; itemize? tokenize?
digitize? sequence?)
Some examples:
|
thread by: Frederic Rentsch |
last post Jan 24 '07 by: Chris Mellon
Hi all,
If I derive a class from another one because I need a few extra
features, is there a way to promote the base class to the derived one
without having to make copies of all attributes?
class Derived (Base):
def __init__ (self, base_object):
# ( copy all attributes )
...
|
thread by: jinal jhaveri |
last post Jul 18 '05 by: Miki Tebeka
Hi I have two files
say
a.py
b.py
a.py has 3 classes
|
thread by: tereglow |
last post Jun 14 '07 by: Facundo Batista
Hello,
I am a complete newbie to Python and am accustomed to coding in PHP/
Perl/Shell. I am trying to do the following:
I have a string:
cpuSpeed = 'Speed: 1000000000'
What I would like to do is extract the '1000000000' from the string,
|
| |
thread by: briefbag |
last post Nov 13 '13 by: bvdet
Hi!
I'm working on a class for a ODE solver, and get a syntax error after the list comprehension for the end of the snippet. I can't seem to find a intuitive better way to write the list - does anyone see what the error is?
class Problem:
def __init__(self, h0, r, R, dt, T):
self.h0 = h0
self.r = r
#(and so on)
|
thread by: Phd |
last post Jul 18 '05 by: Steven Bethard
Hi,
I'm writing a regex related program that lets the user supplies the
regex definition. Is there an easy way to convert a string into a raw
string?
Cheers
|