Re: [Tutor] Copying Variables

2011-07-25 Thread naheed arafat
I got a question in this context. suppose a={'a': 3, 'b': [1, 2], 5: 100} --b=a --vs-- b=copy.copy(a) b[5]=6 b[5]=6 output: --

[Tutor] POST request using httplib2

2011-06-29 Thread naheed arafat
On the way of learning " handling POST request in php" i tried to make a simple python http client using httplib2 & urllib module.. what i wanted to do was submitting username & password field to a php script (which just echo's the username & password) & prints the response in python,not in html/p

Re: [Tutor] Efficiency

2011-06-25 Thread naheed arafat
On Sat, Jun 25, 2011 at 9:42 PM, Steven D'Aprano wrote: > naheed arafat wrote: > >> 1) >> >>> zip('How are you?'.split(' ')[::-1],'i am fine.'.split(' ')) >>>>> >>>> [('you?', 'i

Re: [Tutor] Efficiency

2011-06-25 Thread naheed arafat
On Sat, Jun 25, 2011 at 9:38 PM, Alan Gauld wrote: > > "naheed arafat" wrote > > 1) >> >>> zip('How are you?'.split(' ')[::-1],'i am fine.'.split(' ')) >>>>> >>>> [('you?', '

[Tutor] Efficiency

2011-06-25 Thread naheed arafat
1) >>> zip('How are you?'.split(' ')[::-1],'i am fine.'.split(' ')) [('you?', 'i'), ('are', 'am'), ('How', 'fine.')] >>> map(lambda i,j:(i,j),'How are you?'.split(' ')[::-1],'i am fine.'.split(' ')) [('you?', 'i'), ('are', 'am'), ('How', 'fine.')] Which one has better efficiency? 2) Is there any

Re: [Tutor] using python to write web page

2011-06-15 Thread naheed arafat
Got a question in this context. If i would like to edit an html file. suppose i want to edit the values of href tags or the img tags, what should i do? should I 1. read the file as string, 2.parse it for the tags, 3.edit the tags 4.and then replace the tags by the editted tags 5.delete the main fil

Re: [Tutor] Clunky Password maker

2011-05-25 Thread naheed arafat
On Wed, May 25, 2011 at 11:25 PM, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): > series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ > '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ >

[Tutor] string

2011-05-19 Thread naheed arafat
why there is two way to represent strings in python ? single-coated ( ' ' ) and double-coated ( " " ) strings both serve the purpose of string. Then what is the difference? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opti

Re: [Tutor] dictionary

2011-05-05 Thread naheed arafat
Supposing your dictionary like this: dict={1:'My name is X',2:'My name is x y z',3: 'i am X'} You can use len(list) : >>> dict={1:'My name is X',2:'My name is x y z',3: 'i am X'} >>> for values in dict.values(): ... if len(values.split(' '))>3: ...print values My name is X My name is x

Re: [Tutor] confusions about re module

2011-05-01 Thread naheed arafat
ya.you'r right. left it accidentally.thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] confusions about re module

2011-04-30 Thread naheed arafat
someone please tell me why i'm getting this output? specially the 'e3%' ! ! ! >>> import re >>> re.findall('([\w]+.)','abdd.e3\45 dret.8dj st.jk') ['abdd.', 'e3%', 'dret.', '8dj ', 'st.', 'jk'] I am getting the same output for the following too.. >>> re.findall(r'([\w]+.)','abdd.e3\45 dret.8dj st.

Re: [Tutor] Pictures

2011-04-28 Thread naheed arafat
Observing the page source i think : page=urllib.urlopen('http://finance.blog.lemonde.fr').read() x=re.findall(r"http://s2.lemde.fr/image/2011/02/16/87x0/1480844_7_87fe_bandeau-lycee-electrique.jpg " x.extend(y) x=list(set(x)) for img in x: image=img.split('.')[-1]

Re: [Tutor] Pictures

2011-04-28 Thread naheed arafat
On Thu, Apr 28, 2011 at 6:48 PM, Joel Goldstick wrote: > > > On Wed, Apr 27, 2011 at 11:41 PM, wrote: > >> Hello, >> >> I'm still quite new at this but I'm trying to get a list of the pictures >> adress (... .jpg) of a page of a website. >> >> I thought of using the import urllib and import re, t