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
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?
__
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
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
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
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:
...
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
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
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
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
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
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
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
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
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
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
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?
___
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
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
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()
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
> >
> >
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()
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
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
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'
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():
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
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'
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
.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
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
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
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
. Santosh Kumar
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
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
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
:
> 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
37 matches
Mail list logo