I transfer files a lot between my windows and linux partitions...these
folders sometimes contain *.db and *.ini files which are not recognized or
used by linux. So i tried to write a program to crawl through my home dir
and remove these files...I'm *very* new to programming and python so please
be
Thanks a lot for all the help! If there were a module named
"common-sense" i could insert into my brain...I wouldn't have lost my
/home. Thanks again
Saad
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
print 'done'
elif confirmation == 'n':
pass
else:
sys.exit()
On Sun, Jun 29, 2008 at 9:13 PM, Saad Javed <[EMAIL PROTECTED]> wrote:
> I transfer
Thankyou cedric!
On 6/29/08, Saad Javed <[EMAIL PROTECTED]> wrote:
> I transfer files a lot between my windows and linux partitions...these
> folders sometimes contain *.db and *.ini files which are not recognized or
> used by linux. So i tried to write a program to crawl thro
Hi Tutors,
I'm trying to create a simple GUI using pyqt4 in which pressing a button
causes execution of a system command. Here's the code, please help me out. I
can't figure out whats wrong. Thanks
import sys
import os
from PyQt4 import QtGui, QtCore
class TestGui(QtGui.QWidget):
def __init_
(dial, QtCore.SIGNAL('clicked()'), QtGui.qApp,
QtCore.SLOT(os.system('wvdial')))
TypeError: argument 1 of SLOT() has an invalid type
Was that helpful?
On Sat, Jan 3, 2009 at 9:18 PM, bob gailer wrote:
> Saad Javed wrote:
>
> Hi Tutors,
>
>
> Hi and welcom
I implemented a dial function and passed it to the QtCore.SLOT(), which
worked fine. Thanks everyone!
On Sat, Jan 3, 2009 at 10:33 PM, Kent Johnson wrote:
> On Sat, Jan 3, 2009 at 11:39 AM, Saad Javed wrote:
> > The bold was intentional. I was trying to get a shell command (wvdial) t
I am learning python and need guidance for writing some code. I've written
a simple program (with pointers from people) that parses an tv show xml
feed and prints their values in plain text after performing some string
operations.
[CODE]feed = urllib.urlopen(rssPage) #rssPage: address of xml feed
Sorry for the formatting. Added return statements to both functions. Adding
return [x, y] to get_value func. That solved the problem. Thank you! :)
Saad
On Thursday, February 23, 2012, Alan Gauld wrote:
> On 23/02/12 00:59, Saad Javed wrote:
>
> [CODE]feed = urllib.urlopen(rssPage)
Hi,
a = ['Ron', 'Harry', 'Hermoine']
b = ['25th oct', '27th oct', '29th oct']
c = ['Charms', 'DADA', 'Potions']
I want to print like this:
Ron - 25th oct
Charms
Harry - 27th oct
DADA
Hermoine - 29th oct
Potions
The items in each list are populated dynamically so I don't know how many
items will be
My program downloads multiple entry values from the net. I'm trying to
combine them in a list in a particular sequence.
l = []
feed1 = urllib2.urlopen(rssPage1)
tree1 = etree.parse(feed1)
x = tree1.xpath("/rss/channel/item/title/text()")
y = tree1.xpath("/rss/channel/item/pubDate/text()")
z = tree
l.extend does work. Thanks!
On Monday, October 22, 2012, Saad Javed wrote:
> My program downloads multiple entry values from the net. I'm trying to
> combine them in a list in a particular sequence.
>
> l = []
> feed1 = urllib2.urlopen(rssPage1)
> tree1 = etree.parse(f
Hi,
I'm trying to create a list (L) from items of different lists (a, b, c) but
in a specific order (L = [[a1, b1, c1], [a2, b2, c2]...etc])
L = []
a = [1, 2, 3, 4]
b = ['a', 'b', 'c', 'd']
c = [2009, 2010, 2011, 2012]
for x, y , z in zip(a, b, c):
L.extend([x, y, z])
print L
But this outputs:
[
Hi,
a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry',
'21', 'cookies']]
for i in a:
if (i[1] == '25' or i[1] == '26'):
print 'yes'
else:
print 'Not found'
This prints:
yes
not found
I want it to print "yes" for each positive match but nothing for a negative
m
print *b*
else:
print 'Not found'
This will output:
*jimmy*
*Not found*
*Not found*
*
*
How do I print positive matches (*jimmy*) only and not (*Not found*). I
also want *Not found *to print only *once *if there are no positive matches.
On Wednesday, October 24, 20
Thanks!
If not matched: < does it mean that "if the value of matched is not
true, print Not found"?
print "Not found"
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/t
Hi,
#!/usr/bin/env python
import sys
x = 'Saad is a boy'
def main(x):
a = []
b = x.split(' ')
for item in b:
a.append(item)
print a
if __name__ == '__main__':
x = sys.argv[1]
main(x)
How can I make this program run with the default value of x if I don't
specify an argument at the command line
I've come up with this:
try:
sys.argv[1]
x = sys.argv[1]
main(x)
except IndexError:
main(x)
It works but seems hackish.
Saad
On Monday, October 29, 2012, Saad Javed wrote:
> Hi,
>
> #!/usr/bin/env python
>
> import sys
>
> x = 'Saad is a boy'
>
import smtplib
from_addr = "some_a...@hotmail.com"
to_addr = "some_a...@gmail.com"
smtp_srv = "smtp.live.com"
subject = "Test"
message = "Test"
msg = "To:%s\nFrom:%s\nSubject: %s\n\n%s" % (to_addr, from_addr, subject,
message)
smtp = smtplib.SMTP(smtp_srv, 587)
smtp.set_debuglevel(1)
smtp.ehlo(
I don't think using SSL works with hotmail. I tried using:
smtplib.*SMTP_SSL*("smtp.live.com", 587)
smtplib.login(user, passwd)
...
That gave this error:
Traceback (most recent call last):
File "sendemail.py", line 22, in
smtp = smtplib.SMTP_SSL(smtp_srv, 587)
File "/usr/lib/python2.7/s
Using port 25 with SMTP_SSL gives:
Traceback (most recent call last):
File "sendemail.py", line 22, in
smtp = smtplib.SMTP_SSL(smtp_srv, 25)
File "/usr/lib/python2.7/smtplib.py", line 776, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout)
File "/usr/lib/python2.7/
import time
s = time.time() + 30
running = True
while running:
if time.time() == s:
print 'yes'
running = False
This stops the loop after 30s but the program uses about 12% cpu. What
would be a more efficient way to do this? (p.s. i'm on python 2.7.3)
Saad
___
time.sleep(30) will pause the program for 30s. I want to the run the
program for 30s.
Saad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
import time
running = True
while running:
print 'yes'
time.sleep(10)
This will print 'yes' after every 10s. I want to print 'yes' for 10s, then
quit.
Saad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
ht
What just happened here? :)
I am trying to learn python so i'm sorry if my mistakes seem trivial.
On Saturday, April 13, 2013, Mark Lawrence wrote:
> On 13/04/2013 15:34, Saad Bin Javed wrote:
>
>> I ran into a bit of problem with my revised code based on Steven's
>> suggestions.
>>
>> lst = [''
>
> Don't fight Python, unlike this chap[1] :) Basically if you're looping
> around any data structure you rarely need to use indexing, so try this
> approach.
>
> for item in lst:
> if item.startswith(('Mon','Tue','**Wed','Thu','Fri','Sat','Sun'))**:
> myDict[item] = []
> save
> for item in lst:
>> if
>> item.startswith(('Mon','Tue','**__Wed','Thu','Fri','Sat','Sun'**))__:
>> myDict[item] = []
>> saveItem = item
>> else:
>> myDict[saveItem].append(item._**_strip())
>>
>> Returns:
File "gcalcli_agenda_test.
I don't know what I'm doing wrong here. Ive tried copy-pasting the line.
I've tried entering underscores manually. doesn't work.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo
Steven,
You're right about Mark's email. I didn't get the humor and thought the
remark was kinda tough on me. You correctly pointed out his intent. So my
apologies to Mark.
As for the underscores, what happened is that *I didn't voluntarily add the
underscores to begin with. *If you read the emai
> It looks like you're using Python 2, but you didn't specify.
>
> I'd probably do something like this:
>
> #!/usr/bin/env python
>
> MAX_LENGTH = 140
>
> users = [
> "saad", "asad", "sherry", "danny", "ali", "hasan", "adil",
> "yousaf",
> "maria", "bilal", "owais",
>
> Ah, I see. Sorry, I misread your requirements. Something like this should
> work.
>
> #!/usr/bin/env python
>
> MAX_LENGTH = 140
>
>
> class TweetTooLongError(Exception):
> """
> Raised when a user would be too long to add to the tweet, even
> alone.
> """
>
> ...or, better, remove the if...break and just do:
>
> while users and len(new_message) + len(add) <= MAX_LENGTH:
>
That causes:
Enter string: These are my friends living in the same city as i am. I have
known them for years. They are good people in general. They are:
Traceback (most recent
>
> And the earlier fix now adds two users to a tweet, then one user, then two
> user, then one... :(
>
Enter string: These are my friends living in the same city as i am. I have
known them for years. They are good people in general. They are:
These are my friends living in the same city as i am.
> I don't see how that differs from your expected output...?
>
> > I want all users added to the tweet. E.g. if 4 users can be added to the
> > tweet before reaching the limit, return three tweets...first two with 4
> users
> > attached and the last one with three.
>
> You hit the 140 character lim
I added *len(new_message) + len(add) <= MAX_LENGTH *to the outer while loop
instead of inner which threw an error. Your code works as expected. Thanks
a lot!
Saad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
There was only Chris responding to the question so I removed the line above
the quoted part in my responses that says "On Aug 6, 2013 11:36 PM, "Dave
Angel" wrote:"... is that what's confusing?
On Aug 6, 2013 11:36 PM, "Dave Angel" wrote:
> Saad Javed w
On Wednesday, August 7, 2013, Alan Gauld wrote:
> On 07/08/13 15:41, Saad Javed wrote:
>
>> There was only Chris responding
>>
>
> Apparently he didn't CC the list so the rest of us didn't see it(*).
>
> is that what's confusing?
>>
>
> I
On Thursday, August 8, 2013, Chris Down wrote:
> On 2013-08-08 02:40, Saad Javed wrote:
> > Chris has been emailing me directly. Thats why his responses are not
> > showing up in the conversation.
> > Dear Chris, please remember to send your replies to
> > tutor@python
38 matches
Mail list logo