[Tutor] A small query on fabric

2015-11-20 Thread Santosh Kumar
able to get them running on muliple hosts as i set in my env.hosts list parameters. If anyone has any prior experience with fabric, please asssit. Thanks, -- D. Santosh Kumar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

Re: [Tutor] Ipython Queries

2015-03-15 Thread Santosh Kumar
: > On 14 March 2015 at 09:53, Steven D'Aprano wrote: > > On Fri, Mar 13, 2015 at 10:39:50PM +0530, Santosh Kumar wrote: > >> Hi All, > >> > >> I have installed both python2 and python3 in my system . When i used > >> ipython it by default goes to py

[Tutor] Ipython Queries

2015-03-13 Thread Santosh Kumar
Hi All, I have installed both python2 and python3 in my system . When i used ipython it by default goes to python2 base. How/what is the easy way to swith between python2 and python3 ? Thanks, santosh ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] A small project

2014-12-02 Thread Santosh Kumar
All, Any suggestion to my question ? On Thu, Nov 27, 2014 at 12:43 PM, Santosh Kumar wrote: > Hi All, > > I am planning to start a small project , so i need some suggestions on how > to go about it. > > 1) It basically takes some inputs like (name,age,course,joining > dat

[Tutor] A small project

2014-11-26 Thread Santosh Kumar
. Santosh Kumar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Modules to work with curl.

2014-07-18 Thread Santosh Kumar
ways to run the above statement in a effective way ? 2) How to improve the performance if any? Thanks, santosh On Fri, Jul 18, 2014 at 12:45 AM, Danny Yoo wrote: > On Thu, Jul 17, 2014 at 11:35 AM, Santosh Kumar > wrote: > > > I am currently working on a project , which h

[Tutor] Modules to work with curl.

2014-07-17 Thread Santosh Kumar
Hi, I am currently working on a project , which has lots of curl commands. I am using subprocess.Popen to run these curl commands. But somehow i see its bit slow. Is there a way/module by which i can improve the performance of the program. Thanks, -- D. Santosh Kumar RHCE | SCSA +91-9703206361

[Tutor] Block highlighters in python

2014-04-07 Thread Santosh Kumar
any such facility in python ? -- D. Santosh Kumar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Inheritance in classes

2014-04-07 Thread Santosh Kumar
.value3 Out[6]: 3 If you notice in the below example you will see that the child class object ``obj1`` has inherited all the attibutes of the parent class. Is there a way by which i can make the child class not inherit some of the properites of parent class. -- D. Santosh Kumar

[Tutor] Constructs

2014-04-07 Thread Santosh Kumar
1 #!/usr/bin/python 2 3 class shape: 4 def __init__(self,x,y): 5 self.x = x 6 self.y = y 7 description = "This shape has not been described yet" 8 author = "Nobody has claimed to make this shape yet" 9 10 def __init__(self,x,y,z): 11 self.x = x 12 self.y

Re: [Tutor] viewkeys,viewvalues,viewitems : Use Cases

2014-02-26 Thread Santosh Kumar
I want to understand about where to use , viewkeys() viewvalues() viewitems() Thanks, santosh On Wed, Feb 26, 2014 at 6:59 PM, Alan Gauld wrote: > On 26/02/14 07:04, Santosh Kumar wrote: > > I defined a dictionary a below. >> >> In [14]: a = {'a':1,'b'

Re: [Tutor] calling global in funtions.

2014-02-26 Thread Santosh Kumar
local and global in the same function. All usage > will be global, which will probably be a bug. > -- D. Santosh Kumar RHCE | SCSA +91-9703206361 Every task has a unpleasant side .. But you must focus on the end result you are producing. ___ Tuto

[Tutor] calling global in funtions.

2014-02-25 Thread Santosh Kumar
All, Requirement : i want to call a variable assigned outside a function scope anytime within the function. I read "global" is a way. a) Case I looks fine. b) Case II is bombing out. Is this how it works or please correct me if i am wrong. case I: In [17]: a = 10 In [19]: def fun_local():

[Tutor] viewkeys,viewvalues,viewitems : Use Cases

2014-02-25 Thread Santosh Kumar
All, I defined a dictionary a below. In [14]: a = {'a':1,'b':2,'c':3} In [15]: type(a) Out[15]: dict Funtion associated with dictionaries. In [11]: print a.viewkeys() dict_keys(['a', 'c', 'b']) In [12]: print a.viewvalues() dict_values([1, 3, 2]) In [13]: print a.viewitems() dict_items([('a'

Re: [Tutor] Regular expression - I

2014-02-18 Thread Santosh Kumar
Thank you all. I got it. :) I need to read more between lines . On Wed, Feb 19, 2014 at 4:25 AM, spir wrote: > On 02/18/2014 08:39 PM, Zachary Ware wrote: > >> Hi Santosh, >> >> On Tue, Feb 18, 2014 at 9:52 AM, Santosh Kumar >> wrote: >> >>> >&g

Re: [Tutor] Regular expression - I

2014-02-18 Thread Santosh Kumar
ceeded before going ahead > to call group() on the result (since in this case there is no result). > > > On 18-Feb-2014, at 09:52, Santosh Kumar wrote: > > > > > Hi All, > > > > If you notice the below example, case I is working as expected. > > > > Cas

[Tutor] Regular expression - I

2014-02-18 Thread Santosh Kumar
Hi All, If you notice the below example, case I is working as expected. Case I: In [41]: string = "test" In [42]: re.match('',string).group() Out[42]: '' But why is the raw string 'r' not working as expected ? Case II: In [43]: re.match(r'',string).group()

Re: [Tutor] Regular expressions

2014-02-15 Thread Santosh Kumar
Thank you all. On Thu, Feb 13, 2014 at 10:47 PM, Walter Prins wrote: > Hi, > > On 13 February 2014 06:44, Santosh Kumar wrote: > > I am using ipython. > > > > 1 ) Defined a string. > > > > In [88]: print string > > foo foobar > > > >

[Tutor] Regular expressions

2014-02-12 Thread Santosh Kumar
Hi all, I am using ipython. 1 ) Defined a string. In [88]: print string foo foobar 2) compiled the string to grab the "foo" word. In [89]: reg = re.compile("foo",re.IGNORECASE) 3) Now i am trying to match . In [90]: match = reg.match(string) 4) Now i print it. In [93]: print match.group()

[Tutor] How does # -*- coding: utf-8 -*- work?

2013-01-26 Thread Santosh Kumar
Everything starting with hash character in Python is comment and is not interpreted by the interpreter. So how does that works? Give me full explanation. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.py

[Tutor] How can I modify this simple script for argparse?

2012-10-13 Thread Santosh Kumar
Here is a sample script without argparse implementation: from sys import argv script, filename = argv foo = "This line was written by a Python script." with open(filename, 'a') as file: file.write(foo) I find argparse hard. Just give me a startup. How can I make a asgparse version? ___

[Tutor] list all links with certain extension in an html file python

2012-09-28 Thread Santosh Kumar
I want to extract (no I don't want to download) all links that end in a certain extension. Suppose there is a webpage, and in the head of that webpage there are 4 different CSS files linked to external server. Let the head look like this: http://foo.bar/part1.css";> http://foo.bar/part2.c

[Tutor] Trying to get next item from a list

2012-09-17 Thread Santosh Kumar
Here is the script: alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] i = input("Press any English alphabet: ") current = alphabets.index(i) print(current) next = current+1 print(next) print(alphabets.inde

[Tutor] Confusion with Python, Bash and Command Prompt

2012-08-09 Thread Santosh Kumar
Hello There, We all know that line starting with "#" in Python is a comment. We also know that when the first line of any file (with any extension) has "#!/usr/bin/env bash" and if you make it executable and do ./filename.ext in the terminal then it will be considered as bash file (in this case e

[Tutor] How to import a few modules when I enter python?

2012-08-06 Thread Santosh Kumar
Hello there, I have a few scripts that I made to experiment with, I have to import them everytime I enter the Python shell. The scripts are in `/home/username/workshop/` (this directory has also some non .py files) directory. Is there a way I can import them as soon as I enter Python? Also I am e

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-21 Thread Santosh Kumar
In first half of this script: prompt = raw_input("Can you tell me your name? ") if prompt in ("Yes", "yes", "y", "Y"): name = raw_input("What's your name? ") elif prompt in ("No", "no", "n", "N"): exit("OK, have nice day..") else: prompt = name if name == "Santosh": print "Hey! I

[Tutor] Where do I start developing from?

2012-07-20 Thread Santosh Kumar
Hello There, First time I came in contact with Python programming languages was nearly 1 year (I am learning this languages from my home). Prior to this I was good at PHP, HTML and CSS (this doesn't mean that I want to say that I wanted to become a web developer). I have read many books and tutori

[Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Santosh Kumar
Here is my script: name = raw_input("What's your name? ") if name == "Santosh": print "Hey!! I have the same name." elif name == "John Cleese" or "Michael Palin": print "I have no preference about your name. Really!!" else: print "You have a nice name." The if part works well. The e

[Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Santosh Kumar
Hello There, This problem isn't so simple as it looks in the title/subject of this email. I am doing a tutorial on Python, and there is a script named password.py: password = "foobar" while password != "unicorn": password = raw_input("Password: ") print "Welcome in" The question says "Mod

[Tutor] How does this tiny script works?

2012-07-14 Thread Santosh Kumar
I am reading How to Think Like a Computer Scientist with Python. There is a script in the exercise: if "Ni!": print 'We are the Knights who say, "Ni!"' else: print "Stop it! No more of this!" if 0: print "And now for something completely different.." else: print "Whats all this, t

[Tutor] How to get two user inputs in same prompt seperated by a special character?

2012-07-13 Thread Santosh Kumar
Like in my script: #!/usr/bin/env python #-*- coding:utf-8 -*- print "You will be prompted to enter your height in feet and inches." height_in_feet = input("How much feet are you long: ") remaining_inches = input("How much inches remained? ") inches_in_feet = height_in_feet * 12 total_height_in

[Tutor] A simple "if" and "elif" problem

2012-05-05 Thread Santosh Kumar
I am reading the documentation and I'm in the section 4.1. Let me write it down here: >>> x = int(input("Please enter an integer: ")) Please enter an integer: 42 >>> if x < 0: ... x = 0 ... print('Negative changed to zero') ... elif x == 0: ... print('Zero') ... elif x == 1: ...

[Tutor] What does L at last stands for when 10 ** 30

2012-05-04 Thread Santosh Kumar
I am doing: >>> power = 10 ** 30 >>> power and the output: >>> 1...L # what does L represent interesting thing is L doesn't shows when I do a: print power ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-02 Thread Santosh Kumar
Now its enough info. Thanks all for clearing my doubt. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-01 Thread Santosh Kumar
Its getting complicated now. Will it effect or not? Give me one word answer with one line description. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-01 Thread Santosh Kumar
Is there space a between "#!" and "/usr/bin/env python"? I have seen Python manual, it says <#! /usr/bin/env python> But snippet manager of many text editing programs have <#!/usr/bin/env python>. Python is a strongly typed language, which one is correct? __

[Tutor] Getting started with PyGTK [Receiving Error]

2012-04-28 Thread Santosh Kumar
System Information Ubuntu 11.10 Python 2.7.2 Problem I think my Ubuntu has PyGTK and GTK both already installed. But however when I am importing "gtk" in Python interactive mode then I am getting the following warning: (.:4126): Gtk-WARNING **: Unable to