> With raw_input(), it allows to input value. Can it be used to input
> value with default value option?
Hi Phon,
We can build your own function to do this. Bob showed how to set up code
so that the default's taken if the user just presses enter in his reply.
Let's take a look at it again:
Keo Sophon wrote:
> Hi,
>
> With raw_input(), it allows to input value. Can it be used to input value
> with default value option?
>
response = raw_input("Enter some data:")
if not response: response = "default value"
___
Tutor maillist - Tutor@pyt
Hi,
With raw_input(), it allows to input value. Can it be used to input value with
default value option?
Phon
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Paypal-
I do a lot of system admin type work with Python. If you'd like,
drop me a line and let me know what you're interested in
learning...perhaps I could help you work through a project or two.
Greg Lindstrom
[EMAIL PROTECTED]
___
Tutor maillist -
Payal:
I agree with Kent: the Python Cookbook is an excellent resource. And,
it has a whole section on System Administration. try this URL:
http://aspn.activestate.com/ASPN/Cookbook/Python?kwd=System
You can also try Google. I entered 'Python sysadmin'. Here are just a
few potentially in
> I am a parttime sys admin so I want system admin problem which usually I
> do through shell scripts like parsing logs, generating reports, greping
> with regexes etc.
Hi Payal,
You might also find David Mertz's book "Text Processing With Python" to be
useful for you:
http://gnosis.cx/T
--- Matthew White <[EMAIL PROTECTED]> wrote:
> Hi Hoffman,
>
> It is often useful to use the "for" construct to
> process items in a list.
> e.g.:
>
> >>> list1 = [ 'spam!', 2, ['Ted', 'Rock']]
> >>> for item in list:
> ...print item
> spam!
> 2
> ['Ted', 'Rock']
>
> If you pass a list to
--- Terry Carroll <[EMAIL PROTECTED]> wrote:
> On Mon, 10 Apr 2006, Hoffmann wrote:
>
> > Hello,
> >
> > I have a list: list1 = [ 'spam!', 2, ['Ted',
> 'Rock']
> > ]
> > and I wrote the script below:
> >
> > i = 0
> > while i < len(list1):
> > print list1[i]
> > i += 1
> >
> > Ok. Thi
On Mon, 10 Apr 2006, Hoffmann wrote:
> I also would like to print the length of each element
> of that list:
>
> spam! = 1 element
> 2 = 1 element
> ['Ted', 'Rock'] = 2 elements
>
> Could anyone, please, give me some hints?
The problem is slightly weird, just because you need to clarify what i
On Mon, 10 Apr 2006, Hoffmann wrote:
> Hello,
>
> I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock']
> ]
> and I wrote the script below:
>
> i = 0
> while i < len(list1):
> print list1[i]
> i += 1
>
> Ok. This script will generate as the output each
> element of the original list, on
--- John Fouhy <[EMAIL PROTECTED]> wrote:
> Hi Hoffmann,
>
> On 11/04/06, Hoffmann <[EMAIL PROTECTED]> wrote:
> > I have a list: list1 = [ 'spam!', 2, ['Ted',
> 'Rock'] ]
> > and I wrote the script below:
> >
> > i = 0
> > while i < len(list1):
> > print list1[i]
> > i += 1
>
> Have you
Hi Hoffman,
It is often useful to use the "for" construct to process items in a list.
e.g.:
>>> list1 = [ 'spam!', 2, ['Ted', 'Rock']]
>>> for item in list:
...print item
spam!
2
['Ted', 'Rock']
If you pass a list to the len() function, it will return the number of
elenents in the list. e.g
--- Adam <[EMAIL PROTECTED]> wrote:
> On 10/04/06, Hoffmann <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I have a list: list1 = [ 'spam!', 2, ['Ted',
> 'Rock']
> > ]
> > and I wrote the script below:
> >
> > i = 0
> > while i < len(list1):
> > print list1[i]
> > i += 1
> >
> > Ok. This s
On 10/04/06, Hoffmann <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock']
> ]
> and I wrote the script below:
>
> i = 0
> while i < len(list1):
> print list1[i]
> i += 1
>
> Ok. This script will generate as the output each
> element of the original
Hi Hoffmann,
On 11/04/06, Hoffmann <[EMAIL PROTECTED]> wrote:
> I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock'] ]
> and I wrote the script below:
>
> i = 0
> while i < len(list1):
> print list1[i]
> i += 1
Have you read about "for" loops? The pythonic way of looping through
a list
Hello,
I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock']
]
and I wrote the script below:
i = 0
while i < len(list1):
print list1[i]
i += 1
Ok. This script will generate as the output each
element of the original list, one per line:
spam!
2
['Ted', 'Rock']
I also would like to print
Greg Lindstrom wrote:
> Hello-
>
> For some reason I have decided to learn about decorators; I heard them
> talked up at Pycon the past two years and want to know what all the
> fuss is about. I might even use them in my code :-)
>
> My problem, and this is after reading PEP 318 and other ite
Hello-For some reason I have decided to learn about decorators; I heard them talked up at Pycon the past two years and want to know what all the fuss is about. I might even use them in my code :-)My problem, and this is after reading PEP 318 and other items found when I "Googled" for decorators,
Payal Rathod wrote:
>> What kind of real life problems are you interested in? You might like
>
> I am a parttime sys admin so I want system admin problem which usually I
> do through shell scripts like parsing logs, generating reports, greping
> with regexes etc.
> The only thing I don't want i
Payal Rathod wrote:
> On Mon, Apr 10, 2006 at 10:05:45AM -0400, Kent Johnson wrote:
>
>> You might like to look at "Python Programming for the absolute
>> beginner". It is oriented to beginners and has many examples and
>> exercises.
>>
>
> I might not be able to afford another book, due
On Mon, Apr 10, 2006 at 10:05:45AM -0400, Kent Johnson wrote:
> You might like to look at "Python Programming for the absolute
> beginner". It is oriented to beginners and has many examples and
> exercises.
I might not be able to afford another book, due to high dollar-to-ruppee
rate.
> What k
Payal Rathod wrote:
> Hi,
> I am trying to learn Python seriously for almost 2 months but have not
> gotten far at all. Infact, it seems I have not understood even the basic
> concepts itself. I know some shell, sed and awk programming.
> I have tried reading Learning Python - Mark Lutz
> Think C
Hi,
I am trying to learn Python seriously for almost 2 months but have not
gotten far at all. Infact, it seems I have not understood even the basic
concepts itself. I know some shell, sed and awk programming.
I have tried reading Learning Python - Mark Lutz
Think C Spy
A byte of Python
Non-Progr
23 matches
Mail list logo