| |
thread by: Atrisa |
last post Jan 26 '11 by: Atrisa
I have a file with lines like this:
Host: gateway.edge.messenger.live.com
Referer: 13.gateway.edge.messenger.live.com/help
Host: ads.lfstmedia.com
Referer: http://facebook.mafiawars.com:80/?
Host: gateway.edge.messenger.live.com
Referer: 13.gateway.edge.messenger.live.com/help
Host: ads.lfstmedia.com
|
thread by: francisl |
last post Jul 18 '05 by: francisl
How can we get a full directory size (sum of all his data)?
like when we type `du -sh mydir`
Because os.path.getsize('mydir') only give the size of the directory physical representation on the disk.
Thanks
|
thread by: WIWA |
last post Jul 18 '05 by: Ilya Etingof
I have recently installed pySNMP 3.3.2 and use Python 2.2.2. Thanks to
Peter Hansen, I succeeded to install pySNMP properly. I'm not
completely new to SNMP (I know the basics), but I'm new to Python and
pysnmp. While experimenting, I find some strange things. When using
pySNMP:
1) I can type: 'import pysnmp' or 'from pysnmp import *'
2)...
|
thread by: harijay |
last post Nov 21 '08 by: harijay
Hi
I am a few months new into python. I have used regexps before in perl
and java but am a little confused with this problem.
I want to parse a number of strings and extract only those that
contain a 4 digit number anywhere inside a string
However the regexp
p = re.compile(r'\d{4}')
|
thread by: erik gartz |
last post Jan 11 '08 by: Tim Chase
Hi. I'd like to be able to write a loop such as:
for i in range(10):
pass
but without the i variable. The reason for this is I'm using pylint
and it complains about the unused variable i. I can achieve the above
with more lines of code like:
i = 0
while (i != 10):
i += 1
Is there a concise way to accomplish this without adding extra lines
|
thread by: MrBill |
last post Jul 18 '05 by: MrBill
I would like to be able to open, read, and extract data from a report that
is produced in MS Word. The doc seems to contain embedded spreadsheets. I
would like to extract some of the data from the spreadsheets and feed it
into another application. I've been reading a little bit about OLE and MS
Word and sure would like to find a module that...
|
thread by: james_027 |
last post Jul 27 '07 by: Chris Mellon
hi,
is cls & self the same thing?
I have seen something like
class A:
def dosomething(cls):
#doing something
|
| |
thread by: Thekid |
last post Oct 23 '07 by: Thekid
How do you go about converting something to ASCII using python? I have an example below of some randomly generated text that would need converted:
96,114,101,106,60,
Shift: 27
I don't know where to begin with this....
|
thread by: Tharun03 |
last post Mar 29 '23 by: Roman123456789
Hi
I don't have much experience on python coding. Can someone give me a answer for this ques.
Question: Write a python program that splits a sentence into words. Change the first and last letter of each word into uppercase and display them.
For example if we type input as hello,world
The output must be:
HellO
WorlD
|
thread by: dont bother |
last post Jul 18 '05 by: Greg Ewing (using news.cis.dfn.de)
Hi Buddies,
I am facing this problem and I dont know what to use
as EOF in python:
I want to read a file, and put all the individual
words in a dictionary with their index:
For example if the file is:
Hello there I am doing fine
How are you?
|
thread by: nathanM |
last post Jul 18 '19 by: swaroop11
Hi,
I have a function, looks a bit like this:
def function():
if condition:
do stuff, including a few recursive calls (to function()),
this 'stuff' also changes the state of 'condition'.
'condition' is a global list.
|
thread by: Pradeep Vasudevan |
last post Nov 21 '09 by: alidia45
hai
i am a student and need to write a simple web crawler using python and need some guidance of how to start.. i need to crawl web pages using BFS and also DFS... one using stacks and other using queues...
i will try on the obsolete web pages only and so tht i can learn of how to do that.. i have taken a course called search engines and...
|
thread by: Stewart Midwinter |
last post Jul 18 '05 by: Scott David Daniels
I'd like to do something like the following:
a = 1; b = 2; c = None
mylist =
for my in mylist:
if my is None:
print 'you have a problem with %s' % my #this line is problematic
>>> You have a problem with None
|
thread by: Appu2008 |
last post Aug 7 '22 by: mujtablue
HI,
Iam creating a python application using Tkinter.
Ia trying to attach a scrollbar to a listbox.
Please tell me how can i set the height of the scrollbar to that of
the listbox. Beacuse in the docs i found the fill=X
and fill=Y options, but this is not i want.
I want to limit the height of scrollbar to match the height of listbox.
...
|
thread by: rh0dium |
last post Jul 19 '05 by: Bill Mill
Hi All,
While I know there is a zillion ways to do this.. What is the most
efficient ( in terms of lines of code ) do simply do this.
a=1, b=2, c=3 ... z=26
Now if we really want some bonus points..
a=1, b=2, c=3 ... z=26 aa=27 ab=28 etc..
|
| |
thread by: devnew |
last post Oct 16 '07 by: devnew
i am trying to get the pixel data using im.getpixel()
i am getting a tuple like (152,118,106) for a pixel in a RGB jpeg
image .
what i really want is an integer value representing a pixel ,like waht
i can get from java's BufferedImage.getRGB(x,y) ..
i am wondering if someone can advise me on how i can do this
thanx
dn
|
thread by: eso40043 |
last post Apr 9 '07 by: eso40043
Hello.
Is there an easy one-line way to see if a list of strings contains at least one occurance of a substring? E.g.
string_list=
substring_list=
I really don't want to loop, as I loop too many times in my code already.
|
thread by: kbperry |
last post Apr 21 '06 by: kbperry
On my machine, this runs fine, but when I try to run it on someone
elses machine it blows up with an attribute error:
<code>
import win32com.client, pythoncom
pythoncom.CoInitializeEx(pythoncom.COINIT_APARTMENTTHREADED)
myWord = win32com.client.dynamic.Dispatch ("Word.Application")
myWord.Visible = True
myDoc =...
|
thread by: upftftip |
last post Apr 4 '07 by: James Stroud
I am new to Tkinter. Following an example, I executed the following:
window = Tk()
b = Button(window)
b.configure(bg = '#FF00FF')
b.grid(row = 0, column = 0)
how can I later get the value of this button's background color?
Thanks.
|
thread by: Mitko Haralanov |
last post Oct 20 '06 by: Ben Finney
I need to be able to get the name of the currently executed method
within that method. I know that the method object does have the
__name__ attribute but I know know how to access it from withing the
method.
Something like this:
class A:
.....
def a_method (self, this, that):
|
thread by: rithik |
last post Sep 2 '22 by: sandrahdes
Dear All,
I have a problem while data logging in a single table in SQL DB. We are not able to do it. When we are running the python code in raspberry pi we are getting the following error msg.
Program:
import serial
import time
import MySQLdb as mdb
arduino = serial.Serial("/dev/ttyACM0")
arduino.baudrate=9600
|
thread by: Kamilche |
last post Jul 18 '05 by: Kamilche
Is there a command you can execute in Python that will open a window on
the desktop, such as 'My Documents'? Kind of like 'system', but for
folder names, not just programs. I'm running on Windows 2000.
|
thread by: John Smith |
last post Jul 19 '05 by: Nick Vargish
I already know C/C++ programming and now wish to learn Python to do
scripting for some games that are coming out. What book would you recommend.
I am thinking Teach Your Self Python in 24 Hours is probably the best place
to start...
|
| |
thread by: Thomas Heller |
last post Oct 10 '08 by: Kay Schluehr
Does Python 3 have no way anymore to sort with a comparison function?
Both .sort() and sorted() seem to accept only 'key' and 'reverse' arguments,
the 'cmp' argument seems to be gone. Can that be?
Thomas
|
thread by: tomasz |
last post Dec 18 '07 by: Jonathan Gardner
Hi,
here is a piece of pseudo-code (taken from Ruby) that illustrates the
problem I'd like to solve in Python:
str = 'abc'
if str =~ /(b)/ # Check if str matches a pattern
str = $` + $1 # Perform some action
elsif str =~ /(a)/ # Check another pattern
str = $1 + $' # Perform some other action
|